Geography and Maps geographyandmapswiki https://geographyandmaps.miraheze.org/wiki/Main_Page MediaWiki 1.40.2 first-letter Media Special Talk User User talk Geography and Maps Geography and Maps talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk Module Module talk Main Page 0 1 1 2023-12-17T01:11:49Z MediaWiki default 1 Create main page wikitext text/x-wiki __NOTOC__ == Welcome to {{SITENAME}}! == This Main Page was created automatically and it seems it hasn't been replaced yet. === For the bureaucrat(s) of this wiki === Hello, and welcome to your new wiki! Thank you for choosing Miraheze for the hosting of your wiki, we hope you will enjoy our hosting. You can immediately start working on your wiki or whenever you want. Need help? No problem! We will help you with your wiki as needed. To start, try checking out these helpful links: * [[mw:Special:MyLanguage/Help:Contents|MediaWiki guide]] (e.g. navigation, editing, deleting pages, blocking users) * [[meta:Special:MyLanguage/FAQ|Miraheze FAQ]] * [[meta:Special:MyLanguage/Request features|Request settings changes on your wiki]]. (Extensions, Skin and Logo/Favicon changes should be done through [[Special:ManageWiki]] on your wiki, see [[meta:Special:MyLanguage/ManageWiki|ManageWiki]] for more information.) ==== I still don't understand X! ==== Well, that's no problem. Even if something isn't explained in the documentation/FAQ, we are still happy to help you. You can find us here: * [[meta:Special:MyLanguage/Help center|On our own Miraheze wiki]] * On [[phab:|Phabricator]] * On [https://miraheze.org/discord Discord] * On IRC in #miraheze on irc.libera.chat ([irc://irc.libera.chat/%23miraheze direct link]; [https://web.libera.chat/?channel=#miraheze webchat]) === For visitors of this wiki === Hello, the default Main Page of this wiki (this page) has not yet been replaced by the bureaucrat(s) of this wiki. The bureaucrat(s) might still be working on a Main Page, so please check again later! 21236ac3f8d65e5563b6da6b70815ca6bf1e6616 2 1 2023-12-17T11:02:49Z BaiatArbore 2 Protected "[[Main Page]]": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) wikitext text/x-wiki __NOTOC__ == Welcome to {{SITENAME}}! == This Main Page was created automatically and it seems it hasn't been replaced yet. === For the bureaucrat(s) of this wiki === Hello, and welcome to your new wiki! Thank you for choosing Miraheze for the hosting of your wiki, we hope you will enjoy our hosting. You can immediately start working on your wiki or whenever you want. Need help? No problem! We will help you with your wiki as needed. To start, try checking out these helpful links: * [[mw:Special:MyLanguage/Help:Contents|MediaWiki guide]] (e.g. navigation, editing, deleting pages, blocking users) * [[meta:Special:MyLanguage/FAQ|Miraheze FAQ]] * [[meta:Special:MyLanguage/Request features|Request settings changes on your wiki]]. (Extensions, Skin and Logo/Favicon changes should be done through [[Special:ManageWiki]] on your wiki, see [[meta:Special:MyLanguage/ManageWiki|ManageWiki]] for more information.) ==== I still don't understand X! ==== Well, that's no problem. Even if something isn't explained in the documentation/FAQ, we are still happy to help you. You can find us here: * [[meta:Special:MyLanguage/Help center|On our own Miraheze wiki]] * On [[phab:|Phabricator]] * On [https://miraheze.org/discord Discord] * On IRC in #miraheze on irc.libera.chat ([irc://irc.libera.chat/%23miraheze direct link]; [https://web.libera.chat/?channel=#miraheze webchat]) === For visitors of this wiki === Hello, the default Main Page of this wiki (this page) has not yet been replaced by the bureaucrat(s) of this wiki. The bureaucrat(s) might still be working on a Main Page, so please check again later! 21236ac3f8d65e5563b6da6b70815ca6bf1e6616 3 2 2023-12-17T11:03:37Z BaiatArbore 2 Replaced content with "== {{SITENAME}} ==" wikitext text/x-wiki == {{SITENAME}} == d8a2cc0bdea01a54712c49f90286a9ebc7bbfa52 5 3 2023-12-17T11:08:28Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} 208f6836efcc1ac4767a525042f77d7385691c7f 6 5 2023-12-17T11:10:58Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. Remember to cite your info and properly assess the quality of the source you're citing. 131f059828b24c3121898239a50fc178fe2cbdae 7 6 2023-12-17T11:11:13Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. 57ca01b6656a4c9ba139069808345493d9f9b7e9 8 7 2023-12-17T11:11:37Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> 78356682b9652cb6139ea95b6dab5b2b57d0c00b 9 8 2023-12-17T11:15:20Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> |style="border-spacing:8px; margin:0px -8px; width:50%; height:100%; border:1px solid #B8B5CF; background:#F5F4FF; vertical-align:top; color:#000000;"| {|width="100%" cellpadding="2" cellspacing="5" style="vertical-align:top;" | === Did you know... === |} <!-- Info section --> |style="border-spacing:8px; margin:0px 8px; width:20%; height:100%; border:1px solid #B2C1B0; background:#F1FFEF; vertical-align:top; color:#000000;"| {|width="100%" cellpadding="2" cellspacing="5" style="vertical-align:top;" |<h2 style="font-family: Verdana; margin: 0; background: #DBEFD9; font-size: 120%; font-weight: bold; border: 1px solid #B2C1B0; text-align: left; color: #000000; padding: 0.2em 0.4em;">Help</h2> Below are some valuable resources. More can be found in the [[:Category:Documentation|Documentation]] category. * [[Help:Wiki standards|Wiki standards]] 9ca134b419770930829084f59ab26297e1ec557e 10 9 2023-12-17T11:15:29Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> 78356682b9652cb6139ea95b6dab5b2b57d0c00b 11 10 2023-12-17T11:16:32Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> [[https://geographyandmaps.miraheze.org/wiki/Special:AllPages|{{LargeHeader|header text=See all pages}}]] dbdb0ea4cb24d302734395aba08865b8ea614000 12 11 2023-12-17T11:16:52Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> Click [[https://geographyandmaps.miraheze.org/wiki/Special:AllPages|here]] to see all pages. 99fe0357b249379ab88bccb85bb2b91d528d4210 13 12 2023-12-17T11:17:28Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> Click [[here|https://geographyandmaps.miraheze.org/wiki/Special:AllPages]] to see all pages. 0a51fd804428331a89bba8cd64a2da46b1077c74 14 13 2023-12-17T11:17:52Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> Click [[Special:AllPages|here]] to see all pages. e9facdb2e3cf4eb656545978f892de9d7a531e3d 15 14 2023-12-17T11:18:07Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> = Click [[Special:AllPages|here]] to see all pages. = 6c17f1e28fcf18239898479c698112a8f8aae5a4 16 15 2023-12-17T11:18:16Z BaiatArbore 2 wikitext text/x-wiki {{LargeHeader|header text=Geography and Maps}} <p style="text-align: center;">Welcome to Geography and Maps, a hub for all your cartographic and geographical needs. <br/> If you'd like to contact us then please refer to [[User talk:BaiatArbore]] with any troubles you may have. <br/> Remember to cite your info and properly assess the quality of the source you're citing. </p> Click [[Special:AllPages|here]] to see all pages 0d695daed2548d7b925b505120ce4f285f08f66d Template:LargeHeader 10 2 4 2023-12-17T11:05:13Z BaiatArbore 2 Created page with "<p style='color:{{color}};text-align:center;font-size:32px;background:{{bg color}};font-family:"Cambria";padding:10px'>{{{header text}}}</p> <noinclude> <templatedata> { "params": { "header text": {}, "color": {}, "bg color": {} }, "description": "this is an epic header" } </templatedata> </noinclude>" wikitext text/x-wiki <p style='color:{{color}};text-align:center;font-size:32px;background:{{bg color}};font-family:"Cambria";padding:10px'>{{{header text}}}</p> <noinclude> <templatedata> { "params": { "header text": {}, "color": {}, "bg color": {} }, "description": "this is an epic header" } </templatedata> </noinclude> 70e545a3934c1e4d77a652b53252c2a0f3abb6bc United Kingdom 0 3 17 2023-12-17T11:19:49Z BaiatArbore 2 Created page with "The '''United Kingdom''', officially known as the '''United Kingdom of Great Britain and Northern Ireland''' is a country in North-Western Europe." wikitext text/x-wiki The '''United Kingdom''', officially known as the '''United Kingdom of Great Britain and Northern Ireland''' is a country in North-Western Europe. de1d399f5a18dfe4c1fe29fea73a6ef66bc8974d 18 17 2023-12-17T11:21:08Z BaiatArbore 2 wikitext text/x-wiki The '''United Kingdom''', officially known as the '''United Kingdom of Great Britain and Northern Ireland''' is a country in [[North-Western Europe]] located mostly on the island of [[Great Britain]]. 960be78061ce3f9d0165318fe95add5b3aa7fe9f 19 18 2023-12-17T11:21:57Z BaiatArbore 2 wikitext text/x-wiki The '''United Kingdom''', officially known as the '''United Kingdom of Great Britain and Northern Ireland''' is a country in [[North-Western Europe]] located mostly on the island of [[Great Britain]]. It's made up of 4 countries - [[England]], [[Scotland]], [[Wales]], and [[Northern Ireland]]. af13fe90efd08e819caa9b2702cd1fc806d66a1c 20 19 2023-12-17T11:24:47Z BaiatArbore 2 wikitext text/x-wiki The '''United Kingdom''', officially known as the '''United Kingdom of Great Britain and Northern Ireland''' is a country in [[North-Western Europe]] in the [[British Isles]] Archipelago. It's made up of 4 countries - [[England]], [[Scotland]], [[Wales]], and [[Northern Ireland]] and covers the island of [[Great Britain]], the north-eastern part of the island of [[Ireland]] and other less important islands in the archipelago. 741a060689cce5bc20d994004833df5a5d3c9783 21 20 2023-12-17T11:26:35Z BaiatArbore 2 wikitext text/x-wiki The '''United Kingdom''', officially known as the '''United Kingdom of Great Britain and Northern Ireland''' is a country in [[North-Western Europe]] in the [[British Isles]] Archipelago. It's made up of 4 countries - [[England]], [[Scotland]], [[Wales]], and [[Northern Ireland]] and covers the island of [[Great Britain]], the north-eastern part of the island of [[Ireland]] and other less important islands in the archipelago. The country borders the [[Republic of Ireland]], however it's also encompassed by the [[Atlantic Ocean]]. 88c5185061e3857f1f988f17c999bbca3a9892f0 Template:Infobox settlement 10 4 22 2023-12-17T11:29:04Z BaiatArbore 2 Created page with "<includeonly>{{main other|{{#invoke:Settlement short description|main}}|}}{{Infobox | child = {{yesno|{{{embed|}}}}} | templatestyles = Infobox settlement/styles.css | bodyclass = ib-settlement vcard <!--** names, type, and transliterations ** --> | above = <div class="fn org">{{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}</div> {{#if:{{{native_name|}}}|<div class="nickname ib-settlement-native" {{#if:{{{native_name_lang|}}}|lang="{{{native_name_lang..." wikitext text/x-wiki <includeonly>{{main other|{{#invoke:Settlement short description|main}}|}}{{Infobox | child = {{yesno|{{{embed|}}}}} | templatestyles = Infobox settlement/styles.css | bodyclass = ib-settlement vcard <!--** names, type, and transliterations ** --> | above = <div class="fn org">{{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}</div> {{#if:{{{native_name|}}}|<div class="nickname ib-settlement-native" {{#if:{{{native_name_lang|}}}|lang="{{{native_name_lang}}}"}}>{{{native_name}}}</div>}}{{#if:{{{other_name|}}}|<div class="nickname ib-settlement-other-name">{{{other_name}}}</div>}} | subheader = {{#if:{{{settlement_type|{{{type|}}}}}}|<div class="category">{{{settlement_type|{{{type}}}}}}</div>}} | rowclass1 = mergedtoprow ib-settlement-official | data1 = {{#if:{{{name|}}}|{{{official_name|}}}}} <!-- ***Transliteration language 1*** --> | rowclass2 = mergedtoprow | header2 = {{#if:{{{translit_lang1|}}}|{{{translit_lang1}}}&nbsp;transcription(s)}} | rowclass3 = {{#if:{{{translit_lang1_type1|}}}|mergedrow|mergedbottomrow}} | label3 = &nbsp;•&nbsp;{{{translit_lang1_type}}} | data3 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type|}}}|{{{translit_lang1_info|}}}}}}} | rowclass4 = {{#if:{{{translit_lang1_type2|}}}|mergedrow|mergedbottomrow}} | label4 = &nbsp;•&nbsp;{{{translit_lang1_type1}}} | data4 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type1|}}}|{{{translit_lang1_info1|}}}}}}} | rowclass5 = {{#if:{{{translit_lang1_type3|}}}|mergedrow|mergedbottomrow}} | label5 =&nbsp;•&nbsp;{{{translit_lang1_type2}}} | data5 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type2|}}}|{{{translit_lang1_info2|}}}}}}} | rowclass6 = {{#if:{{{translit_lang1_type4|}}}|mergedrow|mergedbottomrow}} | label6 = &nbsp;•&nbsp;{{{translit_lang1_type3}}} | data6 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type3|}}}|{{{translit_lang1_info3|}}}}}}} | rowclass7 = {{#if:{{{translit_lang1_type5|}}}|mergedrow|mergedbottomrow}} | label7 = &nbsp;•&nbsp;{{{translit_lang1_type4}}} | data7 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type4|}}}|{{{translit_lang1_info4|}}}}}}} | rowclass8 = {{#if:{{{translit_lang1_type6|}}}|mergedrow|mergedbottomrow}} | label8 = &nbsp;•&nbsp;{{{translit_lang1_type5}}} | data8 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type5|}}}|{{{translit_lang1_info5|}}}}}}} | rowclass9 = mergedbottomrow | label9 = &nbsp;•&nbsp;{{{translit_lang1_type6}}} | data9 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type6|}}}|{{{translit_lang1_info6|}}}}}}} <!-- ***Transliteration language 2*** --> | rowclass10 = mergedtoprow | header10 = {{#if:{{{translit_lang2|}}}|{{{translit_lang2}}}&nbsp;transcription(s)}} | rowclass11 = {{#if:{{{translit_lang2_type1|}}}|mergedrow|mergedbottomrow}} | label11 = &nbsp;•&nbsp;{{{translit_lang2_type}}} | data11 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type|}}}|{{{translit_lang2_info|}}}}}}} | rowclass12 = {{#if:{{{translit_lang2_type2|}}}|mergedrow|mergedbottomrow}} | label12 = &nbsp;•&nbsp;{{{translit_lang2_type1}}} | data12 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type1|}}}|{{{translit_lang2_info1|}}}}}}} | rowclass13 = {{#if:{{{translit_lang2_type3|}}}|mergedrow|mergedbottomrow}} | label13 =&nbsp;•&nbsp;{{{translit_lang2_type2}}} | data13 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type2|}}}|{{{translit_lang2_info2|}}}}}}} | rowclass14 = {{#if:{{{translit_lang2_type4|}}}|mergedrow|mergedbottomrow}} | label14 = &nbsp;•&nbsp;{{{translit_lang2_type3}}} | data14 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type3|}}}|{{{translit_lang2_info3|}}}}}}} | rowclass15 = {{#if:{{{translit_lang2_type5|}}}|mergedrow|mergedbottomrow}} | label15 = &nbsp;•&nbsp;{{{translit_lang2_type4}}} | data15 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type4|}}}|{{{translit_lang2_info4|}}}}}}} | rowclass16 = {{#if:{{{translit_lang2_type6|}}}|mergedrow|mergedbottomrow}} | label16 = &nbsp;•&nbsp;{{{translit_lang2_type5}}} | data16 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type5|}}}|{{{translit_lang2_info5|}}}}}}} | rowclass17 = mergedbottomrow | label17 = &nbsp;•&nbsp;{{{translit_lang2_type6}}} | data17 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type6|}}}|{{{translit_lang2_info6|}}}}}}} <!-- end ** names, type, and transliterations ** --> <!-- ***Skyline Image*** --> | rowclass18 = mergedtoprow | data18 = {{#if:{{{image_skyline|}}}|<!-- -->{{#invoke:InfoboxImage|InfoboxImage<!-- -->|image={{{image_skyline|}}}<!-- -->|size={{if empty|{{{image_size|}}}|{{{imagesize|}}}}}|sizedefault=250px<!-- -->|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}<!-- -->|title={{if empty|{{{image_caption|}}}|{{{caption|}}}|{{{image_alt|}}}|{{{alt|}}}}}}}<!-- -->{{#if:{{{image_caption|}}}{{{caption|}}}|<div class="ib-settlement-caption">{{if empty|{{{image_caption|}}}|{{{caption|}}}}}</div>}} }} <!-- ***Flag, Seal, Shield and Coat of arms*** --> | rowclass19 = mergedtoprow | class19 = maptable | data19 = {{#if:{{{image_flag|}}}{{{image_seal|}}}{{{image_shield|}}}{{{image_blank_emblem|}}}{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}} |{{Infobox settlement/columns | 1 = {{#if:{{{image_flag|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_flag}}}|size={{{flag_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|125px|100x100px}}|border={{yesno |{{{flag_border|}}}|yes=yes|blank=yes}}|alt={{{flag_alt|}}}|title=Flag of {{#if:{{{name|}}}|{{{name}}}|{{{official_name}}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type=Flag|link={{{flag_link|}}}|name={{{official_name}}}}}</div>}} | 2 = {{#if:{{{image_seal|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_seal|}}}|size={{{seal_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|alt={{{seal_alt|}}}|title=Official seal of {{#if:{{{name|}}}|{{{name}}}|{{{official_name}}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type={{#if:{{{seal_type|}}}|{{{seal_type}}}|Seal}}|link={{{seal_link|}}}|name={{{official_name}}}}}</div>}} | 3 = {{#if:{{{image_shield|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_shield|}}}||size={{{shield_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|alt={{{shield_alt|}}}|title=Coat of arms of {{#if:{{{name|}}}|{{{name}}}|{{{official_name}}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type=Coat of arms|link={{{shield_link|}}}|name={{{official_name}}}}}</div>}} | 4 = {{#if:{{{image_blank_emblem|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_blank_emblem|}}}|size={{{blank_emblem_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|alt={{{blank_emblem_alt|}}}|title=Official logo of {{#if:{{{name|}}}|{{{name}}}|{{{official_name}}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type={{#if:{{{blank_emblem_type|}}}|{{{blank_emblem_type}}}}}|link={{{blank_emblem_link|}}}|name={{{official_name}}}}}</div>}} | 5 = {{#if:{{{image_map|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map}}}|size={{{mapsize|}}}|sizedefault=100x100px|alt={{{map_alt|}}}|title={{{map_caption|Location of {{#if:{{{name|}}}|{{{name}}}|{{{official_name}}}}}}}}}}{{#if:{{{map_caption|}}}|<div class="ib-settlement-caption-link">{{{map_caption}}}</div>}}}} | 0 = {{#if:{{{pushpin_map_narrow|}}}|{{#if:{{both| {{{pushpin_map|}}} | {{{coordinates|}}} }}| {{location map|{{{pushpin_map|}}} |border = infobox |alt = {{{pushpin_map_alt|}}} |caption ={{#if:{{{pushpin_map_caption_notsmall|}}}|{{{pushpin_map_caption_notsmall|}}}|{{#if:{{{pushpin_map_caption|}}}|{{{pushpin_map_caption}}}|{{#if:{{{map_caption|}}}|{{{map_caption}}}}}}}}} |float = center |width = {{#if:{{{pushpin_mapsize|}}}|{{{pushpin_mapsize}}}|150}} |default_width = 250 |relief= {{{pushpin_relief|}}} |AlternativeMap = {{{pushpin_image|}}} |overlay_image = {{{pushpin_overlay|}}} |coordinates = {{{coordinates|}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{#if:{{{name|}}}|{{{name}}}|{{{official_name|}}}}}}} }} |marksize =6 |outside = {{{pushpin_outside|}}}<!-- pin is outside the map --> |position = {{{pushpin_label_position|}}} }} }} }} }} }} <!-- ***Etymology*** --> | rowclass20 = mergedtoprow | data20 = {{#if:{{{etymology|}}}|Etymology: {{{etymology}}} }} <!-- ***Nickname*** --> | rowclass21 = {{#if:{{{etymology|}}}|mergedrow|mergedtoprow}} | data21 = {{#if:{{{nickname|}}}{{{nicknames|}}}|<!-- -->{{Pluralize from text|parse_links=1|{{if empty|{{{nickname|}}}|{{{nicknames|}}}{{force plural}}}}|<!-- -->link={{{nickname_link|}}}|singular=Nickname|likely=Nickname(s)|plural=Nicknames}}:&nbsp;<!-- --><div class="ib-settlement-nickname nickname">{{if empty|{{{nickname|}}}|{{{nicknames|}}}}}</div><!-- -->{{Main other|{{Pluralize from text|parse_links=1|{{{nickname|}}}|<!-- -->likely=[[Category:Pages using infobox settlement with possible nickname list]]}}}}}} <!-- ***Motto*** --> | rowclass22 = {{#if:{{{etymology|}}}{{{nickname|}}}{{{nicknames|}}}|mergedrow|mergedtoprow}} | data22 = {{#if:{{{motto|}}}{{{mottoes|}}}|<!-- -->{{Pluralize from text|{{if empty|{{{motto|}}}|{{{mottoes|}}}{{force plural}}}}|<!-- -->link={{{motto_link|}}}|singular=Motto|likely=Motto(s)|plural=Mottoes}}:&nbsp;<!-- --><div class="ib-settlement-nickname nickname">{{if empty|{{{motto|}}}|{{{mottoes|}}}}}</div><!-- -->{{Main other|{{Pluralize from text|{{{motto|}}}|<!-- -->likely=[[Category:Pages using infobox settlement with possible motto list]]}}}}}} <!-- ***Anthem*** --> | rowclass23 = {{#if:{{{etymology|}}}{{{nickname|}}}{{{nicknames|}}}{{{motto|}}}{{{mottoes|}}}|mergedrow|mergedtoprow}} | data23 = {{#if:{{{anthem|}}}|{{#if:{{{anthem_link|}}}|[[{{{anthem_link|}}}|Anthem:]]|Anthem:}} {{{anthem}}}}} <!-- ***Map*** --> | rowclass24 = mergedtoprow | data24 = {{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}||{{#if:{{{image_map|}}} |{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map}}}|size={{{mapsize|}}}|sizedefault=250px|alt={{{map_alt|}}}|title={{{map_caption|Location of {{#if:{{{name|}}}|{{{name}}}|{{{official_name}}}}}}}}}}{{#if:{{{map_caption|}}}|<div class="ib-settlement-caption">{{{map_caption}}}</div>}} }}}} | rowclass25 = mergedrow | data25 = {{#if:{{{image_map1|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map1}}}|size={{{mapsize1|}}}|sizedefault=250px|alt={{{map_alt1|}}}|title={{{map_caption1|Location of {{#if:{{{name|}}}|{{{name}}}|{{{official_name}}}}}}}}}}{{#if:{{{map_caption1|}}}|<div class="ib-settlement-caption">{{{map_caption1}}}</div>}} }} <!-- ***Pushpin Map*** --> | rowclass26 = mergedtoprow | data26 = {{#if:{{{pushpin_map_narrow|}}}||{{#if:{{both| {{{pushpin_map|}}} | {{{coordinates|}}} }}| {{location map|{{{pushpin_map|}}} |border = infobox |alt = {{{pushpin_map_alt|}}} |caption ={{#if:{{{pushpin_map_caption_notsmall|}}}|{{{pushpin_map_caption_notsmall|}}}|{{#if:{{{pushpin_map_caption|}}}|{{{pushpin_map_caption}}}|{{#if:{{{map_caption|}}}|{{#if:{{{image_map|}}}||{{{map_caption}}}}}}}}}}} |float = center |width = {{{pushpin_mapsize|}}} |default_width = 250 |relief= {{{pushpin_relief|}}} |AlternativeMap = {{{pushpin_image|}}} |overlay_image = {{{pushpin_overlay|}}} |coordinates = {{{coordinates|}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{#if:{{{name|}}}|{{{name}}}|{{{official_name|}}}}}}} }} |marksize =6 |outside = {{{pushpin_outside|}}}<!-- pin is outside the map --> |position = {{{pushpin_label_position|}}} }} }} }} <!-- ***Coordinates*** --> | rowclass27 = {{#if:{{{image_map|}}}{{{image_map1|}}}{{{pushpin_map|}}}|{{#if:{{{grid_position|}}}|mergedrow|mergedbottomrow}}}} | data27 = {{#if:{{{coordinates|}}} |Coordinates{{#if:{{{coor_pinpoint|{{{coor_type|}}}}}}|&#32;({{{coor_pinpoint|{{{coor_type|}}}}}})}}: {{#invoke:ISO 3166|geocoordinsert|nocat=true|1={{{coordinates|}}}|country={{{subdivision_name|}}}|subdivision1={{{subdivision_name1|}}}|subdivision2={{{subdivision_name2|}}}|subdivision3={{{subdivision_name3|}}}|type=city{{#if:{{{population_total|}}}|{{#iferror:{{#expr:{{formatnum:{{{population_total}}}|R}}+1}}||({{formatnum:{{replace|{{{population_total}}}|,|}}|R}})}}}} }}{{{coordinates_footnotes|}}} }} | rowclass28 = {{#if:{{{image_map|}}}{{{image_map1|}}}{{{pushpin_map|}}}|mergedbottomrow|mergedrow}} | label28 = {{if empty|{{{grid_name|}}}|Grid&nbsp;position}} | data28 = {{{grid_position|}}} <!-- ***Subdivisions*** --> | rowclass29 = mergedtoprow | label29 = {{{subdivision_type}}} | data29 = {{#if:{{{subdivision_type|}}}|{{{subdivision_name|}}} }} | rowclass30 = mergedrow | label30 = {{{subdivision_type1}}} | data30 = {{#if:{{{subdivision_type1|}}}|{{{subdivision_name1|}}} }} | rowclass31 = mergedrow | label31 = {{{subdivision_type2}}} | data31 = {{#if:{{{subdivision_type2|}}}|{{{subdivision_name2|}}} }} | rowclass32 = mergedrow | label32 = {{{subdivision_type3}}} | data32 = {{#if:{{{subdivision_type3|}}}|{{{subdivision_name3|}}} }} | rowclass33 = mergedrow | label33 = {{{subdivision_type4}}} | data33 = {{#if:{{{subdivision_type4|}}}|{{{subdivision_name4|}}} }} | rowclass34 = mergedrow | label34 = {{{subdivision_type5}}} | data34 = {{#if:{{{subdivision_type5|}}}|{{{subdivision_name5|}}} }} | rowclass35 = mergedrow | label35 = {{{subdivision_type6}}} | data35 = {{#if:{{{subdivision_type6|}}}|{{{subdivision_name6|}}} }} <!--***Established*** --> | rowclass36 = mergedtoprow | label36 = {{{established_title}}} | data36 = {{#if:{{{established_title|}}}|{{{established_date|}}} }} | rowclass37 = mergedrow | label37 = {{{established_title1}}} | data37 = {{#if:{{{established_title1|}}}|{{{established_date1|}}} }} | rowclass38 = mergedrow | label38 = {{{established_title2}}} | data38 = {{#if:{{{established_title2|}}}|{{{established_date2|}}} }} | rowclass39 = mergedrow | label39 = {{{established_title3}}} | data39 = {{#if:{{{established_title3|}}}|{{{established_date3|}}} }} | rowclass40 = mergedrow | label40 = {{{established_title4}}} | data40 = {{#if:{{{established_title4|}}}|{{{established_date4|}}} }} | rowclass41 = mergedrow | label41 = {{{established_title5}}} | data41 = {{#if:{{{established_title5|}}}|{{{established_date5|}}} }} | rowclass42 = mergedrow | label42 = {{{established_title6}}} | data42 = {{#if:{{{established_title6|}}}|{{{established_date6|}}} }} | rowclass43 = mergedrow | label43 = {{{established_title7}}} | data43 = {{#if:{{{established_title7|}}}|{{{established_date7|}}} }} | rowclass44 = mergedrow | label44 = {{{extinct_title}}} | data44 = {{#if:{{{extinct_title|}}}|{{{extinct_date|}}} }} | rowclass45 = mergedrow | label45 = Founded by | data45 = {{{founder|}}} | rowclass46 = mergedrow | label46 = [[Namesake|Named for]] | data46 = {{{named_for|}}} <!-- ***Seat of government and subdivisions within the settlement*** --> | rowclass47 = mergedtoprow | label47 = {{#if:{{{seat_type|}}}|{{{seat_type}}}|Seat}} | data47 = {{{seat|}}} | rowclass48 = mergedrow | label48 = {{#if:{{{seat1_type|}}}|{{{seat1_type}}}|Former seat}} | data48 = {{{seat1|}}} | rowclass49 = mergedrow | label49 = {{#if:{{{seat2_type|}}}|{{{seat2_type}}}|Former seat}} | data49 = {{{seat2|}}} | rowclass51 = {{#if:{{{seat|}}}{{{seat1|}}}{{{seat2|}}}|mergedrow|mergedtoprow}} | label51 = {{#if:{{{parts_type|}}}|{{{parts_type}}}|Boroughs}} | data51 = {{#if:{{{parts|}}}{{{p1|}}} |{{#ifeq:{{{parts_style|}}}|para |<b>{{{parts|}}}{{#if:{{both|{{{parts|}}}|{{{p1|}}}}}|&#58;&nbsp;|}}</b>{{comma separated entries|{{{p1|}}}|{{{p2|}}}|{{{p3|}}}|{{{p4|}}}|{{{p5|}}}|{{{p6|}}}|{{{p7|}}}|{{{p8|}}}|{{{p9|}}}|{{{p10|}}}|{{{p11|}}}|{{{p12|}}}|{{{p13|}}}|{{{p14|}}}|{{{p15|}}}|{{{p16|}}}|{{{p17|}}}|{{{p18|}}}|{{{p19|}}}|{{{p20|}}}|{{{p21|}}}|{{{p22|}}}|{{{p23|}}}|{{{p24|}}}|{{{p25|}}}|{{{p26|}}}|{{{p27|}}}|{{{p28|}}}|{{{p29|}}}|{{{p30|}}}|{{{p31|}}}|{{{p32|}}}|{{{p33|}}}|{{{p34|}}}|{{{p35|}}}|{{{p36|}}}|{{{p37|}}}|{{{p38|}}}|{{{p39|}}}|{{{p40|}}}|{{{p41|}}}|{{{p42|}}}|{{{p43|}}}|{{{p44|}}}|{{{p45|}}}|{{{p46|}}}|{{{p47|}}}|{{{p48|}}}|{{{p49|}}}|{{{p50|}}}}} |{{#if:{{{p1|}}}|{{Collapsible list|title={{{parts|}}}|expand={{#switch:{{{parts_style|}}}|coll=|list=y|{{#if:{{{p6|}}}||y}}}}|1={{{p1|}}}|2={{{p2|}}}|3={{{p3|}}}|4={{{p4|}}}|5={{{p5|}}}|6={{{p6|}}}|7={{{p7|}}}|8={{{p8|}}}|9={{{p9|}}}|10={{{p10|}}}|11={{{p11|}}}|12={{{p12|}}}|13={{{p13|}}}|14={{{p14|}}}|15={{{p15|}}}|16={{{p16|}}}|17={{{p17|}}}|18={{{p18|}}}|19={{{p19|}}}|20={{{p20|}}}|21={{{p21|}}}|22={{{p22|}}}|23={{{p23|}}}|24={{{p24|}}}|25={{{p25|}}}|26={{{p26|}}}|27={{{p27|}}}|28={{{p28|}}}|29={{{p29|}}}|30={{{p30|}}}|31={{{p31|}}}|32={{{p32|}}}|33={{{p33|}}}|34={{{p34|}}}|35={{{p35|}}}|36={{{p36|}}}|37={{{p37|}}}|38={{{p38|}}}|39={{{p39|}}}|40={{{p40|}}}|41={{{p41|}}}|42={{{p42|}}}|43={{{p43|}}}|44={{{p44|}}}|45={{{p45|}}}|46={{{p46|}}}|47={{{p47|}}}|48={{{p48|}}}|49={{{p49|}}}|50={{{p50|}}}}} |{{{parts}}} }} }} }} <!-- ***Government type and Leader*** --> | rowclass52 = mergedtoprow | header52 = {{#if:{{{government_type|}}}{{{governing_body|}}}{{{leader_name|}}}{{{leader_name1|}}}{{{leader_name2|}}}{{{leader_name3|}}}{{{leader_name4|}}}|Government<div class="ib-settlement-fn">{{{government_footnotes|}}}</div>}} <!-- ***Government*** --> | rowclass53 = mergedrow | label53 = &nbsp;•&nbsp;Type | data53 = {{{government_type|}}} | rowclass54 = mergedrow | label54 = &nbsp;•&nbsp;Body | class54 = agent | data54 = {{{governing_body|}}} | rowclass55 = mergedrow | label55 = &nbsp;•&nbsp;{{{leader_title}}} | data55 = {{#if:{{{leader_title|}}}|{{{leader_name|}}} {{#if:{{{leader_party|}}}|({{Polparty|{{{subdivision_name}}}|{{{leader_party}}}}})}}}} | rowclass56 = mergedrow | label56 = &nbsp;•&nbsp;{{{leader_title1}}} | data56 = {{#if:{{{leader_title1|}}}|{{{leader_name1|}}}}} | rowclass57 = mergedrow | label57 = &nbsp;•&nbsp;{{{leader_title2}}} | data57 = {{#if:{{{leader_title2|}}}|{{{leader_name2|}}}}} | rowclass58 = mergedrow | label58 = &nbsp;•&nbsp;{{{leader_title3}}} | data58 = {{#if:{{{leader_title3|}}}|{{{leader_name3|}}}}} | rowclass59 = mergedrow | label59 = &nbsp;•&nbsp;{{{leader_title4}}} | data59 = {{#if:{{{leader_title4|}}}|{{{leader_name4|}}}}} | rowclass60 = mergedrow | label60 = {{{government_blank1_title}}} | data60 = {{#if:{{{government_blank1|}}}|{{{government_blank1|}}}}} | rowclass61 = mergedrow | label61 = {{{government_blank2_title}}} | data61 = {{#if:{{{government_blank2|}}}|{{{government_blank2|}}}}} | rowclass62 = mergedrow | label62 = {{{government_blank3_title}}} | data62 = {{#if:{{{government_blank3|}}}|{{{government_blank3|}}}}} | rowclass63 = mergedrow | label63 = {{{government_blank4_title}}} | data63 = {{#if:{{{government_blank4|}}}|{{{government_blank4|}}}}} | rowclass64 = mergedrow | label64 = {{{government_blank5_title}}} | data64 = {{#if:{{{government_blank5|}}}|{{{government_blank5|}}}}} | rowclass65 = mergedrow | label65 = {{{government_blank6_title}}} | data65 = {{#if:{{{government_blank6|}}}|{{{government_blank6|}}}}} <!-- ***Geographical characteristics*** --> <!-- ***Area*** --> | rowclass66 = mergedtoprow | header66 = {{#if:{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}{{{area_land_km2|}}}{{{area_land_ha|}}}{{{area_land_acre|}}}{{{area_land_sq_mi|}}}{{{area_water_km2|}}}{{{area_water_ha|}}}{{{area_water_acre|}}}{{{area_water_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_ha|}}}{{{area_urban_acre|}}}{{{area_urban_sq_mi|}}}{{{area_rural_sq_mi|}}}{{{area_rural_ha|}}}{{{area_rural_acre|}}}{{{area_rural_km2|}}}{{{area_metro_km2|}}}{{{area_metro_ha|}}}{{{area_metro_acre|}}}{{{area_blank1_km2|}}}{{{area_blank1_ha|}}}{{{area_blank1_acre|}}}{{{area_metro_sq_mi|}}}{{{area_blank1_sq_mi|}}} |{{#if:{{both|{{#ifeq:{{{total_type}}}|&nbsp;|1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}} |<!-- displayed below --> |Area<div class="ib-settlement-fn">{{{area_footnotes|}}}</div> }} }} | rowclass67 = {{#if:{{both|{{#ifeq:{{{total_type}}}|&nbsp;|1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}}|mergedtoprow|mergedrow}} | label67 = {{#if:{{both|{{#ifeq:{{{total_type}}}|&nbsp;|1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}} |Area<div class="ib-settlement-fn">{{{area_footnotes|}}}</div> |&nbsp;•&nbsp;{{#if:{{{total_type|}}}|{{{total_type}}}|{{#if:{{{area_metro_km2|}}}{{{area_metro_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_sq_mi|}}}{{{area_rural_km2|}}}{{{area_rural_sq_mi|}}}{{{population_metro|}}}{{{population_urban|}}}{{{population_rural|}}}|{{#if:{{{settlement_type|{{{type|}}}}}}|{{{settlement_type|{{{type}}}}}}|City}}|Total}}}} }} | data67 = {{#if:{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}} |{{infobox_settlement/areadisp |km2 ={{{area_total_km2|}}} |ha ={{{area_total_ha|}}} |acre ={{{area_total_acre|}}} |sqmi ={{{area_total_sq_mi|}}} |dunam={{{area_total_dunam|}}} |link ={{#switch:{{{dunam_link|}}}||on|total=on}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass68 = mergedrow | label68 = &nbsp;•&nbsp;Land | data68 = {{#if:{{{area_land_km2|}}}{{{area_land_ha|}}}{{{area_land_acre|}}}{{{area_land_sq_mi|}}}{{{area_land_dunam|}}} |{{infobox_settlement/areadisp |km2 ={{{area_land_km2|}}} |ha ={{{area_land_ha|}}} |acre ={{{area_land_acre|}}} |sqmi ={{{area_land_sq_mi|}}} |dunam={{{area_land_dunam|}}} |link ={{#ifeq:{{{dunam_link|}}}|land|on}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass69 = mergedrow | label69 = &nbsp;•&nbsp;Water | data69 = {{#if:{{{area_water_km2|}}}{{{area_water_ha|}}}{{{area_water_acre|}}}{{{area_water_sq_mi|}}}{{{area_water_dunam|}}} |{{infobox_settlement/areadisp |km2 ={{{area_water_km2|}}} |ha ={{{area_water_ha|}}} |acre ={{{area_water_acre|}}} |sqmi ={{{area_water_sq_mi|}}} |dunam={{{area_water_dunam|}}} |link ={{#ifeq:{{{dunam_link|}}}|water|on}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }} {{#if:{{{area_water_percent|}}}| &nbsp;{{{area_water_percent}}}{{#ifeq:%|{{#invoke:string|sub|{{{area_water_percent|}}}|-1}}||%}}}}}} | rowclass70 = mergedrow | label70 = &nbsp;•&nbsp;Urban<div class="ib-settlement-fn">{{{area_urban_footnotes|}}}</div> | data70 = {{#if:{{{area_urban_km2|}}}{{{area_urban_ha|}}}{{{area_urban_acre|}}}{{{area_urban_sq_mi|}}}{{{area_urban_dunam|}}} |{{infobox_settlement/areadisp |km2 ={{{area_urban_km2|}}} |ha ={{{area_urban_ha|}}} |acre ={{{area_urban_acre|}}} |sqmi ={{{area_urban_sq_mi|}}} |dunam={{{area_urban_dunam|}}} |link ={{#ifeq:{{{dunam_link|}}}|urban|on}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass71 = mergedrow | label71 = &nbsp;•&nbsp;Rural<div class="ib-settlement-fn">{{{area_rural_footnotes|}}}</div> | data71 = {{#if:{{{area_rural_km2|}}}{{{area_rural_ha|}}}{{{area_rural_acre|}}}{{{area_rural_sq_mi|}}}{{{area_rural_dunam|}}} |{{infobox_settlement/areadisp |km2 ={{{area_rural_km2|}}} |ha ={{{area_rural_ha|}}} |acre ={{{area_rural_acre|}}} |sqmi ={{{area_rural_sq_mi|}}} |dunam={{{area_rural_dunam|}}} |link ={{#ifeq:{{{dunam_link|}}}|rural|on}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass72 = mergedrow | label72 =&nbsp;•&nbsp;Metro<div class="ib-settlement-fn">{{{area_metro_footnotes|}}}</div> | data72 = {{#if:{{{area_metro_km2|}}}{{{area_metro_ha|}}}{{{area_metro_acre|}}}{{{area_metro_sq_mi|}}}{{{area_metro_dunam|}}} |{{infobox_settlement/areadisp |km2 ={{{area_metro_km2|}}} |ha ={{{area_metro_ha|}}} |acre ={{{area_metro_acre|}}} |sqmi ={{{area_metro_sq_mi|}}} |dunam={{{area_metro_dunam|}}} |link ={{#ifeq:{{{dunam_link|}}}|metro|on}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} <!-- ***Area rank*** --> | rowclass73 = mergedrow | label73 = &nbsp;•&nbsp;Rank | data73 = {{{area_rank|}}} | rowclass74 = mergedrow | label74 = &nbsp;•&nbsp;{{{area_blank1_title}}} | data74 = {{#if:{{{area_blank1_km2|}}}{{{area_blank1_ha|}}}{{{area_blank1_acre|}}}{{{area_blank1_sq_mi|}}}{{{area_blank1_dunam|}}} |{{infobox_settlement/areadisp |km2 ={{{area_blank1_km2|}}} |ha ={{{area_blank1_ha|}}} |acre ={{{area_blank1_acre|}}} |sqmi ={{{area_blank1_sq_mi|}}} |dunam={{{area_blank1_dunam|}}} |link ={{#ifeq:{{{dunam_link|}}}|blank1|on}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass75 = mergedrow | label75 = &nbsp;•&nbsp;{{{area_blank2_title}}} | data75 = {{#if:{{{area_blank2_km2|}}}{{{area_blank2_ha|}}}{{{area_blank2_acre|}}}{{{area_blank2_sq_mi|}}}{{{area_blank2_dunam|}}} |{{infobox_settlement/areadisp |km2 ={{{area_blank2_km2|}}} |ha ={{{area_blank2_ha|}}} |acre ={{{area_blank2_acre|}}} |sqmi ={{{area_blank2_sq_mi|}}} |dunam={{{area_blank2_dunam|}}} |link ={{#ifeq:{{{dunam_link|}}}|blank2|on}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass76 = mergedrow | label76 = &nbsp; | data76 = {{{area_note|}}} <!-- ***Dimensions*** --> | rowclass77 = mergedtoprow | header77 = {{#if:{{{length_km|}}}{{{length_mi|}}}{{{width_km|}}}{{{width_mi|}}}|Dimensions<div class="ib-settlement-fn">{{{dimensions_footnotes|}}}</div>}} | rowclass78 = mergedrow | label78 = &nbsp;•&nbsp;Length | data78 = {{#if:{{{length_km|}}}{{{length_mi|}}} | {{infobox_settlement/lengthdisp |km ={{{length_km|}}} |mi ={{{length_mi|}}} |pref={{{unit_pref}}} |name={{{subdivision_name}}} }} }} | rowclass79 = mergedrow | label79 = &nbsp;•&nbsp;Width | data79 = {{#if:{{{width_km|}}}{{{width_mi|}}} |{{infobox_settlement/lengthdisp |km ={{{width_km|}}} |mi ={{{width_mi|}}} |pref={{{unit_pref}}} |name={{{subdivision_name}}} }} }} <!-- ***Elevation*** --> | rowclass80 = mergedtoprow | label80 = {{#if:{{{elevation_link|}}}|[[{{{elevation_link|}}}|Elevation]]|Elevation}}<div class="ib-settlement-fn">{{{elevation_footnotes|}}}{{#if:{{{elevation_point|}}}|&#32;({{{elevation_point}}})}}</div> | data80 = {{#if:{{{elevation_m|}}}{{{elevation_ft|}}} |{{infobox_settlement/lengthdisp |m ={{{elevation_m|}}} |ft ={{{elevation_ft|}}} |pref={{{unit_pref}}} |name={{{subdivision_name}}} }} }} | rowclass81 = {{#if:{{{elevation_m|}}}{{{elevation_ft|}}}|mergedrow|mergedtoprow}} | label81 = Highest&nbsp;elevation<div class="ib-settlement-fn">{{{elevation_max_footnotes|}}}{{#if:{{{elevation_max_point|}}}|&#32;({{{elevation_max_point}}})}}</div> | data81 = {{#if:{{{elevation_max_m|}}}{{{elevation_max_ft|}}} |{{infobox_settlement/lengthdisp |m ={{{elevation_max_m|}}} |ft ={{{elevation_max_ft|}}} |pref={{{unit_pref}}} |name={{{subdivision_name}}} }} }} <!-- ***Elevation max rank*** --> | rowclass82 = mergedrow | label82 = &nbsp;•&nbsp;Rank | data82 = {{#if:{{{elevation_max_m|}}}{{{elevation_max_ft|}}}| {{{elevation_max_rank|}}} }} | rowclass83 = {{#if:{{{elevation_min_rank|}}}|mergedrow|mergedbottomrow}} | label83 = Lowest&nbsp;elevation<div class="ib-settlement-fn">{{{elevation_min_footnotes|}}}{{#if:{{{elevation_min_point|}}}|&#32;({{{elevation_min_point}}})}}</div> | data83 = {{#if:{{{elevation_min_m|}}}{{{elevation_min_ft|}}} |{{infobox_settlement/lengthdisp |m ={{{elevation_min_m|}}} |ft ={{{elevation_min_ft|}}} |pref={{{unit_pref}}} |name={{{subdivision_name}}} }} }} <!-- ***Elevation min rank*** --> | rowclass84 = mergedrow | label84 = &nbsp;•&nbsp;Rank | data84 = {{#if:{{{elevation_min_m|}}}{{{elevation_min_ft|}}}|{{{elevation_min_rank|}}}}} <!-- ***Population*** --> | rowclass85 = mergedtoprow | label85 = Population<div class="ib-settlement-fn">{{#if:{{{population_as_of|}}}|{{nbsp}}({{{population_as_of}}})}}{{{population_footnotes|}}}</div> | data85 = {{fix comma category|{{#if:{{{population|}}} | {{formatnum:{{replace|{{{population}}}|,|}}}} | {{#ifeq:{{{total_type}}}|&nbsp; | {{#if:{{{population_total|}}} | {{formatnum:{{replace|{{{population_total}}}|,|}}}} }} }} }}}} | rowclass86 = mergedtoprow | header86 = {{#if:{{{population|}}} | |{{#ifeq:{{{total_type}}}|&nbsp; | |{{#if:{{{population_total|}}}{{{population_urban|}}}{{{population_rural|}}}{{{population_metro|}}}{{{population_blank1|}}}{{{population_blank2|}}}{{{population_est|}}} |Population<div class="ib-settlement-fn">{{#if:{{{population_as_of|}}}|{{nbsp}}({{{population_as_of}}})}}{{{population_footnotes|}}}</div> }} }} }} | rowclass87 = mergedrow | label87 = &nbsp;•&nbsp;{{#if:{{{total_type|}}}|{{{total_type}}}|{{#if:{{{population_metro|}}}{{{population_urban|}}}{{{population_rural|}}}{{{area_metro_km2|}}}{{{area_metro_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_sq_mi|}}}{{{area_rural_km2|}}}{{{area_rural_sq_mi|}}}|{{#if:{{{settlement_type|{{{type|}}}}}}|{{{settlement_type|{{{type}}}}}}|City}}|Total}}}} | data87 = {{#if:{{{population|}}} | |{{#ifeq:{{{total_type}}}|&nbsp; | |{{#if:{{{population_total|}}} | {{fix comma category|{{formatnum:{{replace|{{{population_total}}}|,|}}}}}} }} }} }} | rowclass88 = mergedrow | label88 = &nbsp;•&nbsp;Estimate&nbsp;<div class="ib-settlement-fn">({{{pop_est_as_of}}}){{{pop_est_footnotes|}}}</div> | data88 = {{#if:{{{population_est|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_est}}}|,|}}}}}} }} <!-- ***Population rank*** --> | rowclass89 = mergedrow | label89 =&nbsp;•&nbsp;Rank | data89 = {{{population_rank|}}} | rowclass90 = mergedrow | label90 = &nbsp;•&nbsp;Density | data90 = {{#if:{{{population_density_km2|}}}{{{population_density_sq_mi|}}}{{{population_total|}}} |{{infobox_settlement/densdisp |/km2 ={{{population_density_km2|}}} |/sqmi={{{population_density_sq_mi|}}} |pop ={{{population_total|}}} |dunam={{{area_total_dunam|}}} |ha ={{{area_total_ha|}}} |km2 ={{{area_total_km2|}}} |acre ={{{area_total_acre|}}} |sqmi ={{{area_total_sq_mi|}}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} <!-- ***Population density rank*** --> | rowclass91 = mergedrow | label91 = &nbsp;&nbsp;•&nbsp;Rank | data91 = {{{population_density_rank|}}} | rowclass92 = mergedrow | label92 = &nbsp;•&nbsp;[[Urban area|Urban]]<div class="ib-settlement-fn">{{{population_urban_footnotes|}}}</div> | data92 = {{#if:{{{population_urban|}}}| {{fix comma category|{{formatnum:{{replace|{{{population_urban}}}|,|}}}}}} }} | rowclass93 = mergedrow | label93 = &nbsp;•&nbsp;Urban&nbsp;density | data93 = {{#if:{{{population_density_urban_km2|}}}{{{population_density_urban_sq_mi|}}}{{{population_urban|}}} |{{infobox_settlement/densdisp |/km2 ={{{population_density_urban_km2|}}} |/sqmi={{{population_density_urban_sq_mi|}}} |pop ={{{population_urban|}}} |ha ={{{area_urban_ha|}}} |km2 ={{{area_urban_km2|}}} |acre ={{{area_urban_acre|}}} |sqmi ={{{area_urban_sq_mi|}}} |dunam={{{area_urban_dunam|}}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass94 = mergedrow | label94 = &nbsp;•&nbsp;[[Rural area|Rural]]<div class="ib-settlement-fn">{{{population_rural_footnotes|}}}</div> | data94 = {{#if:{{{population_rural|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_rural}}}|,|}}}}}}}} | rowclass95 = mergedrow | label95 = &nbsp;•&nbsp;Rural&nbsp;density | data95 = {{#if:{{{population_density_rural_km2|}}}{{{population_density_rural_sq_mi|}}}{{{population_rural|}}} |{{infobox_settlement/densdisp |/km2 ={{{population_density_rural_km2|}}} |/sqmi={{{population_density_rural_sq_mi|}}} |pop ={{{population_rural|}}} |ha ={{{area_rural_ha|}}} |km2 ={{{area_rural_km2|}}} |acre ={{{area_rural_acre|}}} |sqmi ={{{area_rural_sq_mi|}}} |dunam={{{area_rural_dunam|}}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass96 = mergedrow | label96 =&nbsp;•&nbsp;[[Metropolitan area|Metro]]<div class="ib-settlement-fn">{{{population_metro_footnotes|}}}</div> | data96 = {{#if:{{{population_metro|}}}| {{fix comma category|{{formatnum:{{replace|{{{population_metro}}}|,|}}}}}} }} | rowclass97 = mergedrow | label97 = &nbsp;•&nbsp;Metro&nbsp;density | data97 = {{#if:{{{population_density_metro_km2|}}}{{{population_density_metro_sq_mi|}}}{{{population_metro|}}} |{{infobox_settlement/densdisp |/km2 ={{{population_density_metro_km2|}}} |/sqmi={{{population_density_metro_sq_mi|}}} |pop ={{{population_metro|}}} |ha ={{{area_metro_ha|}}} |km2 ={{{area_metro_km2|}}} |acre ={{{area_metro_acre|}}} |sqmi ={{{area_metro_sq_mi|}}} |dunam={{{area_metro_dunam|}}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass98 = mergedrow | label98 = &nbsp;•&nbsp;{{{population_blank1_title|}}}<div class="ib-settlement-fn">{{{population_blank1_footnotes|}}}</div> | data98 = {{#if:{{{population_blank1|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_blank1}}}|,|}}}}}}}} | rowclass99 = mergedrow | label99 = &nbsp;•&nbsp;{{#if:{{{population_blank1_title|}}}|{{{population_blank1_title}}} density|Density}} | data99 = {{#if:{{{population_density_blank1_km2|}}}{{{population_density_blank1_sq_mi|}}}{{{population_blank1|}}} |{{infobox_settlement/densdisp |/km2 ={{{population_density_blank1_km2|}}} |/sqmi={{{population_density_blank1_sq_mi|}}} |pop ={{{population_blank1|}}} |ha ={{{area_blank1_ha|}}} |km2 ={{{area_blank1_km2|}}} |acre ={{{area_blank1_acre|}}} |sqmi ={{{area_blank1_sq_mi|}}} |dunam={{{area_blank1_dunam|}}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass100 = mergedrow | label100 = &nbsp;•&nbsp;{{{population_blank2_title|}}}<div class="ib-settlement-fn">{{{population_blank2_footnotes|}}}</div> | data100 = {{#if:{{{population_blank2|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_blank2}}}|,|}}}}}}}} | rowclass101 = mergedrow | label101 = &nbsp;•&nbsp;{{#if:{{{population_blank2_title|}}}|{{{population_blank2_title}}} density|Density}} | data101 = {{#if:{{{population_density_blank2_km2|}}}{{{population_density_blank2_sq_mi|}}}{{{population_blank2|}}} |{{infobox_settlement/densdisp |/km2 ={{{population_density_blank2_km2|}}} |/sqmi={{{population_density_blank2_sq_mi|}}} |pop ={{{population_blank2|}}} |ha ={{{area_blank2_ha|}}} |km2 ={{{area_blank2_km2|}}} |acre ={{{area_blank2_acre|}}} |sqmi ={{{area_blank2_sq_mi|}}} |dunam={{{area_blank2_dunam|}}} |pref ={{{unit_pref}}} |name ={{{subdivision_name}}} }}}} | rowclass102 = mergedrow | label102 = &nbsp; | data102 = {{{population_note|}}} | rowclass103 = mergedtoprow | label103 = {{Pluralize from text|{{if empty|{{{population_demonym|}}}|{{{population_demonyms|}}}{{force plural}}}}|<!-- -->link=Demonym|singular=Demonym|likely=Demonym(s)|plural=Demonyms}} | data103 = {{if empty|{{{population_demonym|}}}|{{{population_demonyms|}}}}}{{Main other|{{Pluralize from text|{{{population_demonym|}}}|likely=[[Category:Pages using infobox settlement with possible demonym list]]}}}} <!-- ***Demographics 1*** --> | rowclass104 = mergedtoprow | header104 = {{#if:{{{demographics_type1|}}} |{{{demographics_type1}}}<div class="ib-settlement-fn">{{{demographics1_footnotes|}}}</div>}} | rowclass105 = mergedrow | label105 = &nbsp;•&nbsp;{{{demographics1_title1}}} | data105 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title1|}}}|{{{demographics1_info1|}}}}}}} | rowclass106 = mergedrow | label106 = &nbsp;•&nbsp;{{{demographics1_title2}}} | data106 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title2|}}}|{{{demographics1_info2|}}}}}}} | rowclass107 = mergedrow | label107 = &nbsp;•&nbsp;{{{demographics1_title3}}} | data107 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title3|}}}|{{{demographics1_info3|}}}}}}} | rowclass108 = mergedrow | label108 = &nbsp;•&nbsp;{{{demographics1_title4}}} | data108 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title4|}}}|{{{demographics1_info4|}}}}}}} | rowclass109 = mergedrow | label109 = &nbsp;•&nbsp;{{{demographics1_title5}}} | data109 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title5|}}}|{{{demographics1_info5|}}}}}}} | rowclass110 = mergedrow | label110 = &nbsp;•&nbsp;{{{demographics1_title6}}} | data110 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title6|}}}|{{{demographics1_info6|}}}}}}} | rowclass111 = mergedrow | label111 = &nbsp;•&nbsp;{{{demographics1_title7}}} | data111 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title7|}}}|{{{demographics1_info7|}}}}}}} | rowclass112 = mergedrow | label112 = &nbsp;•&nbsp;{{{demographics1_title8}}} | data112 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title8|}}}|{{{demographics1_info8|}}}}}}} | rowclass113 = mergedrow | label113 = &nbsp;•&nbsp;{{{demographics1_title9}}} | data113 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title9|}}}|{{{demographics1_info9|}}}}}}} | rowclass114 = mergedrow | label114 = &nbsp;•&nbsp;{{{demographics1_title10}}} | data114 = {{#if:{{{demographics_type1|}}} |{{#if:{{{demographics1_title10|}}}|{{{demographics1_info10|}}}}}}} <!-- ***Demographics 2*** --> | rowclass115 = mergedtoprow | header115 = {{#if:{{{demographics_type2|}}} |{{{demographics_type2}}}<div class="ib-settlement-fn">{{{demographics2_footnotes|}}}</div>}} | rowclass116 = mergedrow | label116 = &nbsp;•&nbsp;{{{demographics2_title1}}} | data116 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title1|}}}|{{{demographics2_info1|}}}}}}} | rowclass117 = mergedrow | label117 = &nbsp;•&nbsp;{{{demographics2_title2}}} | data117 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title2|}}}|{{{demographics2_info2|}}}}}}} | rowclass118 = mergedrow | label118 = &nbsp;•&nbsp;{{{demographics2_title3}}} | data118 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title3|}}}|{{{demographics2_info3|}}}}}}} | rowclass119 = mergedrow | label119 = &nbsp;•&nbsp;{{{demographics2_title4}}} | data119 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title4|}}}|{{{demographics2_info4|}}}}}}} | rowclass120 = mergedrow | label120 = &nbsp;•&nbsp;{{{demographics2_title5}}} | data120 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title5|}}}|{{{demographics2_info5|}}}}}}} | rowclass121 = mergedrow | label121 = &nbsp;•&nbsp;{{{demographics2_title6}}} | data121 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title6|}}}|{{{demographics2_info6|}}}}}}} | rowclass122 = mergedrow | label122 = &nbsp;•&nbsp;{{{demographics2_title7}}} | data122 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title7|}}}|{{{demographics2_info7|}}}}}}} | rowclass123 = mergedrow | label123 = &nbsp;•&nbsp;{{{demographics2_title8}}} | data123 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title8|}}}|{{{demographics2_info8|}}}}}}} | rowclass124 = mergedrow | label124 = &nbsp;•&nbsp;{{{demographics2_title9}}} | data124 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title9|}}}|{{{demographics2_info9|}}}}}}} | rowclass125 = mergedrow | label125 = &nbsp;•&nbsp;{{{demographics2_title10}}} | data125 = {{#if:{{{demographics_type2|}}} |{{#if:{{{demographics2_title10|}}}|{{{demographics2_info10|}}}}}}} <!-- ***Time Zones*** --> | rowclass126 = mergedtoprow | header126 = {{#if:{{{timezone1_location|}}}|{{#if:{{{timezone2|}}}|[[{{#if:{{{timezone_link|}}}|{{{timezone_link}}}|Time zone}}|Time zone]]s|[[{{#if:{{{timezone_link|}}}|{{{timezone_link}}}|Time zone}}|Time zone]]}}|}} | rowclass127 = {{#if:{{{timezone1_location|}}}|mergedrow|mergedtoprow}} | label127 = {{#if:{{{timezone1_location|}}}|{{{timezone1_location}}}|{{#if:{{{timezone2_location|}}}|{{{timezone2_location}}}|{{#if:{{{timezone2|}}}|[[{{#if:{{{timezone_link|}}}|{{{timezone_link}}}|Time zone}}|Time zone]]s|[[{{#if:{{{timezone_link|}}}|{{{timezone_link}}}|Time zone}}|Time zone]]}}}}}} | data127 = {{#if:{{{utc_offset1|{{{utc_offset|}}} }}} |[[UTC{{{utc_offset1|{{{utc_offset}}}}}}]] {{#if:{{{timezone1|{{{timezone|}}}}}}|({{{timezone1|{{{timezone}}}}}})}} |{{{timezone1|{{{timezone|}}}}}} }} | rowclass128 = mergedrow | label128 = <span class="nowrap">&nbsp;•&nbsp;Summer ([[Daylight saving time|DST]])</span> | data128 = {{#if:{{{utc_offset1_DST|{{{utc_offset_DST|}}}}}} |[[UTC{{{utc_offset1_DST|{{{utc_offset_DST|}}}}}}]] {{#if:{{{timezone1_DST|{{{timezone_DST|}}}}}}|({{{timezone1_DST|{{{timezone_DST}}}}}})}} |{{{timezone1_DST|{{{timezone_DST|}}}}}} }} | rowclass129 = mergedrow | label129 = {{#if:{{{timezone2_location|}}}| {{{timezone2_location|}}}|<nowiki />}} | data129 = {{#if:{{{timezone1|{{{timezone|}}}}}}{{{utc_offset1|{{{utc_offset|}}}}}} |{{#if:{{{utc_offset2|{{{utc_offset2|}}} }}} |[[UTC{{{utc_offset2|{{{utc_offset2}}}}}}]] {{#if:{{{timezone2|}}}|({{{timezone2}}})}} |{{{timezone2|}}} }} }} | rowclass130 = mergedrow | label130 = <span class="nowrap">&nbsp;•&nbsp;Summer ([[Daylight saving time|DST]])</span> | data130 = {{#if:{{{utc_offset2_DST|}}}|[[UTC{{{utc_offset2_DST|}}}]] {{#if:{{{timezone2_DST|}}}|({{{timezone2_DST|}}})}} |{{{timezone2_DST|}}} }} | rowclass131 = mergedrow | label131 = {{#if:{{{timezone3_location|}}}| {{{timezone3_location|}}}|<nowiki />}} | data131 = {{#if:{{{timezone1|{{{timezone|}}}}}}{{{utc_offset1|{{{utc_offset|}}}}}} |{{#if:{{{utc_offset3|{{{utc_offset3|}}} }}} |[[UTC{{{utc_offset3|{{{utc_offset3}}}}}}]] {{#if:{{{timezone3|}}}|({{{timezone3}}})}} |{{{timezone3|}}} }} }} | rowclass132 = mergedrow | label132 = <span class="nowrap">&nbsp;•&nbsp;Summer ([[Daylight saving time|DST]])</span> | data132 = {{#if:{{{utc_offset3_DST|}}}|[[UTC{{{utc_offset3_DST|}}}]] {{#if:{{{timezone3_DST|}}}|({{{timezone3_DST|}}})}} |{{{timezone3_DST|}}} }} | rowclass133 = mergedrow | label133 = {{#if:{{{timezone4_location|}}}| {{{timezone4_location|}}}|<nowiki />}} | data133 = {{#if:{{{timezone1|{{{timezone|}}}}}}{{{utc_offset1|{{{utc_offset|}}}}}} |{{#if:{{{utc_offset4|{{{utc_offset4|}}} }}} |[[UTC{{{utc_offset4|{{{utc_offset4}}}}}}]] {{#if:{{{timezone4|}}}|({{{timezone4}}})}} |{{{timezone4|}}} }} }} | rowclass134 = mergedrow | label134 = <span class="nowrap">&nbsp;•&nbsp;Summer ([[Daylight saving time|DST]])</span> | data134 = {{#if:{{{utc_offset4_DST|}}}|[[UTC{{{utc_offset4_DST|}}}]] {{#if:{{{timezone4_DST|}}}|({{{timezone4_DST|}}})}} |{{{timezone4_DST|}}} }} | rowclass135 = mergedrow | label135 = {{#if:{{{timezone5_location|}}}| {{{timezone5_location|}}}|<nowiki />}} | data135 = {{#if:{{{timezone1|{{{timezone|}}}}}}{{{utc_offset1|{{{utc_offset|}}}}}} |{{#if:{{{utc_offset5|{{{utc_offset5|}}} }}} |[[UTC{{{utc_offset5|{{{utc_offset5}}}}}}]] {{#if:{{{timezone5|}}}|({{{timezone5}}})}} |{{{timezone5|}}} }} }} | rowclass136 = mergedrow | label136 = <span class="nowrap">&nbsp;•&nbsp;Summer ([[Daylight saving time|DST]])</span> | data136 = {{#if:{{{utc_offset5_DST|}}}|[[UTC{{{utc_offset5_DST|}}}]] {{#if:{{{timezone5_DST|}}}|({{{timezone5_DST|}}})}} |{{{timezone5_DST|}}} }} <!-- ***Postal Code(s)*** --> | rowclass137 = mergedtoprow | label137 = {{{postal_code_type}}} | class137 = adr | data137 = {{#if:{{{postal_code_type|}}}|{{#if:{{{postal_code|}}}|<div class="postal-code">{{{postal_code}}}</div>}}}} | rowclass138 = {{#if:{{#if:{{{postal_code_type|}}}|{{#if:{{{postal_code|}}}|1}}}}|mergedbottomrow|mergedtoprow}} | label138 = {{{postal2_code_type}}} | class138 = adr | data138 = {{#if:{{{postal_code_type|}}}|{{#if:{{{postal2_code_type|}}}|{{#if:{{{postal2_code|}}}|<div class="postal-code">{{{postal2_code}}}</div>}} }} }} <!-- ***Area Code(s)*** --> | rowclass139 = {{#if:{{#if:{{{postal_code_type|}}}|{{#if:{{{postal_code|}}}|1}}}}{{#if:{{{postal_code_type|}}}|{{#if:{{{postal2_code_type|}}}|{{#if:{{{postal2_code|}}}|1}}}}}}|mergedrow|mergedtoprow}} | label139 = {{if empty|{{{area_code_type|}}}|{{Pluralize from text|any_comma=1|parse_links=1|{{if empty|{{{area_code|}}}|{{{area_codes|}}}{{force plural}}}}|<!-- -->link=Telephone numbering plan|singular=Area code|likely=Area code(s)|plural=Area codes}}}} | data139 = {{if empty|{{{area_code|}}}|{{{area_codes|}}}}}{{#if:{{{area_code_type|}}}||{{Main other|{{Pluralize from text|any_comma=1|parse_links=1|{{{area_code|}}}|||[[Category:Pages using infobox settlement with possible area code list]]}}}}}} <!-- Geocode--> | rowclass140 = {{#if:{{#if:{{{postal_code_type|}}}|{{#if:{{{postal_code|}}}|1}}}}{{#if:{{{postal_code_type|}}}|{{#if:{{{postal2_code_type|}}}|{{#if:{{{postal2_code|}}}|1}}}}}}{{{area_code|}}}|mergedrow|mergedtoprow}} | label140 = [[Geocode]] | class140 = nickname | data140 = {{{geocode|}}} <!-- ISO Code--> | rowclass141 = {{#if:{{#if:{{{postal_code_type|}}}|{{#if:{{{postal_code|}}}|1}}}}{{#if:{{{postal_code_type|}}}|{{#if:{{{postal2_code_type|}}}|{{#if:{{{postal2_code|}}}|1}}}}}}{{{area_code|}}}{{{geocode|}}}|mergedrow|mergedtoprow}} | label141 = [[ISO 3166|ISO 3166 code]] | class141 = nickname | data141 = {{{iso_code|}}} <!-- Vehicle registration plate--> | rowclass142 = {{#if:{{#if:{{{postal_code_type|}}}|{{#if:{{{postal_code|}}}|1}}}}{{#if:{{{postal_code_type|}}}|{{#if:{{{postal2_code_type|}}}|{{#if:{{{postal2_code|}}}|1}}}}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}|mergedrow|mergedtoprow}} | label142 = {{#if:{{{registration_plate_type|}}}|{{{registration_plate_type}}}|[[Vehicle registration plate|Vehicle registration]]}} | data142 = {{{registration_plate|}}} <!-- Other codes --> | rowclass143 = {{#if:{{#if:{{{postal_code_type|}}}|{{#if:{{{postal_code|}}}|1}}}}{{#if:{{{postal_code_type|}}}|{{#if:{{{postal2_code_type|}}}|{{#if:{{{postal2_code|}}}|1}}}}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}|{{{registration_plate|}}}|mergedrow|mergedtoprow}} | label143 = {{{code1_name|}}} | class143 = nickname | data143 = {{#if:{{{code1_name|}}}|{{{code1_info|}}}}} | rowclass144 = {{#if:{{#if:{{{postal_code_type|}}}|{{#if:{{{postal_code|}}}|1}}}}{{#if:{{{postal_code_type|}}}|{{#if:{{{postal2_code_type|}}}|{{#if:{{{postal2_code|}}}|1}}}}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}|{{{registration_plate|}}}|{{{code1_name|}}}|mergedrow|mergedtoprow}} | label144 = {{{code2_name|}}} | class144 = nickname | data144 = {{#if:{{{code2_name|}}}|{{{code2_info|}}}}} <!-- ***Blank Fields (two sections)*** --> | rowclass145 = mergedtoprow | label145 = {{{blank_name_sec1|{{{blank_name|}}}}}} | data145 = {{#if:{{{blank_name_sec1|{{{blank_name|}}}}}}|{{{blank_info_sec1|{{{blank_info|}}}}}}}} | rowclass146 = mergedrow | label146 = {{{blank1_name_sec1|{{{blank1_name|}}}}}} | data146 = {{#if:{{{blank1_name_sec1|{{{blank1_name|}}}}}}|{{{blank1_info_sec1|{{{blank1_info|}}}}}}}} | rowclass147 = mergedrow | label147 = {{{blank2_name_sec1|{{{blank2_name|}}}}}} | data147 = {{#if:{{{blank2_name_sec1|{{{blank2_name|}}}}}}|{{{blank2_info_sec1|{{{blank2_info|}}}}}}}} | rowclass148 = mergedrow | label148 = {{{blank3_name_sec1|{{{blank3_name|}}}}}} | data148 = {{#if:{{{blank3_name_sec1|{{{blank3_name|}}}}}}|{{{blank3_info_sec1|{{{blank3_info|}}}}}}}} | rowclass149 = mergedrow | label149 = {{{blank4_name_sec1|{{{blank4_name|}}}}}} | data149 = {{#if:{{{blank4_name_sec1|{{{blank4_name|}}}}}}|{{{blank4_info_sec1|{{{blank4_info|}}}}}}}} | rowclass150 = mergedrow | label150 = {{{blank5_name_sec1|{{{blank5_name|}}}}}} | data150 = {{#if:{{{blank5_name_sec1|{{{blank5_name|}}}}}}|{{{blank5_info_sec1|{{{blank5_info|}}}}}}}} | rowclass151 = mergedrow | label151 = {{{blank6_name_sec1|{{{blank6_name|}}}}}} | data151 = {{#if:{{{blank6_name_sec1|{{{blank6_name|}}}}}}|{{{blank6_info_sec1|{{{blank6_info|}}}}}}}} | rowclass152 = mergedrow | label152 = {{{blank7_name_sec1|{{{blank7_name|}}}}}} | data152 = {{#if:{{{blank7_name_sec1|{{{blank7_name|}}}}}}|{{{blank7_info_sec1|{{{blank7_info|}}}}}}}} | rowclass153 = mergedtoprow | label153 = {{{blank_name_sec2}}} | data153 = {{#if:{{{blank_name_sec2|}}}|{{{blank_info_sec2|}}}}} | rowclass154 = mergedrow | label154 = {{{blank1_name_sec2}}} | data154 = {{#if:{{{blank1_name_sec2|}}}|{{{blank1_info_sec2|}}}}} | rowclass155 = mergedrow | label155 = {{{blank2_name_sec2}}} | data155 = {{#if:{{{blank2_name_sec2|}}}|{{{blank2_info_sec2|}}}}} | rowclass156 = mergedrow | label156 = {{{blank3_name_sec2}}} | data156 = {{#if:{{{blank3_name_sec2|}}}|{{{blank3_info_sec2|}}}}} | rowclass157 = mergedrow | label157 = {{{blank4_name_sec2}}} | data157 = {{#if:{{{blank4_name_sec2|}}}|{{{blank4_info_sec2|}}}}} | rowclass158 = mergedrow | label158 = {{{blank5_name_sec2}}} | data158 = {{#if:{{{blank5_name_sec2|}}}|{{{blank5_info_sec2|}}}}} | rowclass159 = mergedrow | label159 = {{{blank6_name_sec2}}} | data159 = {{#if:{{{blank6_name_sec2|}}}|{{{blank6_info_sec2|}}}}} | rowclass160 = mergedrow | label160 = {{{blank7_name_sec2}}} | data160 = {{#if:{{{blank7_name_sec2|}}}|{{{blank7_info_sec2|}}}}} <!-- ***Website*** --> | rowclass161 = mergedtoprow | label161 = Website | data161 = {{#if:{{{website|}}}|{{{website}}}}} | class162 = maptable | data162 = {{#if:{{{module|}}}|{{{module}}}}} <!-- ***Footnotes*** --> | belowrowclass = mergedtoprow | below = {{{footnotes|}}} }}<!-- Check for unknowns -->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox settlement with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox settlement]] with unknown parameter "_VALUE_"|ignoreblank=y | alt | anthem | anthem_link | area_blank1_acre | area_blank1_dunam | area_blank1_ha | area_blank1_km2 | area_blank1_sq_mi | area_blank1_title | area_blank2_acre | area_blank2_dunam | area_blank2_ha | area_blank2_km2 | area_blank2_sq_mi | area_blank2_title | area_code | area_code_type | area_codes | area_footnotes | area_land_acre | area_land_dunam | area_land_ha | area_land_km2 | area_land_sq_mi | area_metro_acre | area_metro_dunam | area_metro_footnotes | area_metro_ha | area_metro_km2 | area_metro_sq_mi | area_note | area_rank | area_rural_acre | area_rural_dunam | area_rural_footnotes | area_rural_ha | area_rural_km2 | area_rural_sq_mi | area_total_acre | area_total_dunam | area_total_ha | area_total_km2 | area_total_sq_mi | area_urban_acre | area_urban_dunam | area_urban_footnotes | area_urban_ha | area_urban_km2 | area_urban_sq_mi | area_water_acre | area_water_dunam | area_water_ha | area_water_km2 | area_water_percent | area_water_sq_mi | blank_emblem_alt | blank_emblem_link | blank_emblem_size | blank_emblem_type | blank_info | blank_info_sec1 | blank_info_sec2 | blank_name | blank_name_sec1 | blank_name_sec2 | blank1_info | blank1_info_sec1 | blank1_info_sec2 | blank1_name | blank1_name_sec1 | blank1_name_sec2 | blank2_info | blank2_info_sec1 | blank2_info_sec2 | blank2_name | blank2_name_sec1 | blank2_name_sec2 | blank3_info | blank3_info_sec1 | blank3_info_sec2 | blank3_name | blank3_name_sec1 | blank3_name_sec2 | blank4_info | blank4_info_sec1 | blank4_info_sec2 | blank4_name | blank4_name_sec1 | blank4_name_sec2 | blank5_info | blank5_info_sec1 | blank5_info_sec2 | blank5_name | blank5_name_sec1 | blank5_name_sec2 | blank6_info | blank6_info_sec1 | blank6_info_sec2 | blank6_name | blank6_name_sec1 | blank6_name_sec2 | blank7_info | blank7_info_sec1 | blank7_info_sec2 | blank7_name | blank7_name_sec1 | blank7_name_sec2 | caption | code1_info | code1_name | code2_info | code2_name | coor_pinpoint | coor_type | coordinates | coordinates_footnotes | demographics_type1 | demographics_type2 | demographics1_footnotes | demographics1_info1 | demographics1_info10 | demographics1_info2 | demographics1_info3 | demographics1_info4 | demographics1_info5 | demographics1_info6 | demographics1_info7 | demographics1_info8 | demographics1_info9 | demographics1_title1 | demographics1_title10 | demographics1_title2 | demographics1_title3 | demographics1_title4 | demographics1_title5 | demographics1_title6 | demographics1_title7 | demographics1_title8 | demographics1_title9 | demographics2_footnotes | demographics2_info1 | demographics2_info10 | demographics2_info2 | demographics2_info3 | demographics2_info4 | demographics2_info5 | demographics2_info6 | demographics2_info7 | demographics2_info8 | demographics2_info9 | demographics2_title1 | demographics2_title10 | demographics2_title2 | demographics2_title3 | demographics2_title4 | demographics2_title5 | demographics2_title6 | demographics2_title7 | demographics2_title8 | demographics2_title9 | dimensions_footnotes | dunam_link | elevation_footnotes | elevation_ft | elevation_link | elevation_m | elevation_max_footnotes | elevation_max_ft | elevation_max_m | elevation_max_point | elevation_max_rank | elevation_min_footnotes | elevation_min_ft | elevation_min_m | elevation_min_point | elevation_min_rank | elevation_point | embed | established_date | established_date1 | established_date2 | established_date3 | established_date4 | established_date5 | established_date6 | established_date7 | established_title | established_title1 | established_title2 | established_title3 | established_title4 | established_title5 | established_title6 | established_title7 | etymology | extinct_date | extinct_title | flag_alt | flag_border | flag_link | flag_size | footnotes | founder | geocode | governing_body | government_footnotes | government_type | government_blank1_title | government_blank1 | government_blank2_title | government_blank2 | government_blank2_title | government_blank3 | government_blank3_title | government_blank3 | government_blank4_title | government_blank4 | government_blank5_title | government_blank5 | government_blank6_title | government_blank6 | grid_name | grid_position | image_alt | image_blank_emblem | image_caption | image_flag | image_map | image_map1 | image_seal | image_shield | image_size | image_skyline | imagesize | iso_code | leader_name | leader_name1 | leader_name2 | leader_name3 | leader_name4 | leader_party | leader_title | leader_title1 | leader_title2 | leader_title3 | leader_title4 | length_km | length_mi | map_alt | map_alt1 | map_caption | map_caption1 | mapsize | mapsize1 | module | motto | motto_link | mottoes | name | named_for | native_name | native_name_lang | nickname | nickname_link | nicknames | official_name | other_name | p1 | p10 | p11 | p12 | p13 | p14 | p15 | p16 | p17 | p18 | p19 | p2 | p20 | p21 | p22 | p23 | p24 | p25 | p26 | p27 | p28 | p29 | p3 | p30 | p31 | p32 | p33 | p34 | p35 | p36 | p37 | p38 | p39 | p4 | p40 | p41 | p42 | p43 | p44 | p45 | p46 | p47 | p48 | p49 | p5 | p50 | p6 | p7 | p8 | p9 | parts | parts_style | parts_type | pop_est_as_of | pop_est_footnotes | population | population_as_of | population_blank1 | population_blank1_footnotes | population_blank1_title | population_blank2 | population_blank2_footnotes | population_blank2_title | population_demonym | population_demonyms | population_density_blank1_km2 | population_density_blank1_sq_mi | population_density_blank2_km2 | population_density_blank2_sq_mi | population_density_km2 | population_density_metro_km2 | population_density_metro_sq_mi | population_density_rank | population_density_rural_km2 | population_density_rural_sq_mi | population_density_sq_mi | population_density_urban_km2 | population_density_urban_sq_mi | population_est | population_footnotes | population_metro | population_metro_footnotes | population_note | population_rank | population_rural | population_rural_footnotes | population_total | population_urban | population_urban_footnotes | postal_code | postal_code_type | postal2_code | postal2_code_type | pushpin_image | pushpin_label | pushpin_label_position | pushpin_map | pushpin_map_alt | pushpin_map_caption | pushpin_map_caption_notsmall | pushpin_map_narrow | pushpin_mapsize | pushpin_outside | pushpin_overlay | pushpin_relief | registration_plate | registration_plate_type | seal_alt | seal_link | seal_size | seal_type | seat | seat_type | seat1 | seat1_type | seat2 | seat2_type | settlement_type | shield_alt | shield_link | shield_size | subdivision_name | subdivision_name1 | subdivision_name2 | subdivision_name3 | subdivision_name4 | subdivision_name5 | subdivision_name6 | subdivision_type | subdivision_type1 | subdivision_type2 | subdivision_type3 | subdivision_type4 | subdivision_type5 | subdivision_type6 | timezone | timezone_DST | timezone_link | timezone1 | timezone1_DST | timezone1_location | timezone2 | timezone2_DST | timezone2_location | timezone3 | timezone3_DST | timezone3_location | timezone4 | timezone4_DST | timezone4_location | timezone5 | timezone5_DST | timezone5_location | total_type | translit_lang1 | translit_lang1_info | translit_lang1_info1 | translit_lang1_info2 | translit_lang1_info3 | translit_lang1_info4 | translit_lang1_info5 | translit_lang1_info6 | translit_lang1_type | translit_lang1_type1 | translit_lang1_type2 | translit_lang1_type3 | translit_lang1_type4 | translit_lang1_type5 | translit_lang1_type6 | translit_lang2 | translit_lang2_info | translit_lang2_info1 | translit_lang2_info2 | translit_lang2_info3 | translit_lang2_info4 | translit_lang2_info5 | translit_lang2_info6 | translit_lang2_type | translit_lang2_type1 | translit_lang2_type2 | translit_lang2_type3 | translit_lang2_type4 | translit_lang2_type5 | translit_lang2_type6 | type | unit_pref | utc_offset | utc_offset_DST | utc_offset1 | utc_offset1_DST | utc_offset2 | utc_offset2_DST | utc_offset3 | utc_offset3_DST | utc_offset4 | utc_offset4_DST | utc_offset5 | utc_offset5_DST | website | width_km | width_mi }}<!-- -->{{#invoke:Check for clobbered parameters|check | template = Infobox settlement | cat = {{main other|Category:Pages using infobox settlement with conflicting parameters}} | population; population_total | image_size; imagesize | image_alt; alt | image_caption; caption }}<!-- Wikidata -->{{#if:{{{coordinates_wikidata|}}}{{{wikidata|}}} |[[Category:Pages using infobox settlement with the wikidata parameter]] }}{{main other|<!-- Missing country -->{{#if:{{{subdivision_name|}}}||[[Category:Pages using infobox settlement with missing country]]}}<!-- No map -->{{#if:{{{pushpin_map|}}}{{{image_map|}}}{{{image_map1|}}}||[[Category:Pages using infobox settlement with no map]]}}<!-- Image_map1 without image_map -->{{#if:{{{image_map1|}}}|{{#if:{{{image_map|}}}||[[Category:Pages using infobox settlement with image_map1 but not image_map]]}}}}<!-- No coordinates -->{{#if:{{{coordinates|}}}||[[Category:Pages using infobox settlement with no coordinates]]}}<!-- -->{{#if:{{{type|}}}|{{#ifeq:{{{settlement_type|a}}}|{{{settlement_type|b}}}|[[Category:Pages using infobox settlement with ignored type]]|}}|}}<!-- Ignored type parameter -->{{#if:{{{embed|}}}|[[Category:Pages using infobox settlement with embed]]}} }}</includeonly><noinclude> {{documentation}} <!--Please add this template's categories to the /doc subpage, not here - thanks!--> </noinclude> 25c18e8fb79d36b7cb4f56765b3d79c8a3fd0dab Module:Infobox 828 5 23 2023-12-17T11:30:00Z BaiatArbore 2 Created page with "local p = {} local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false local lists = { plainlist_t = { patterns = { '^plainlist$', '%splainlist$', '^plainlist%s', '%splainlist%s' }, found = false, styles = 'Plainlist/styles.css' }, hlist_t = { patterns = { '^hlist$', '%shlist$', '^hlist%s', '%shlist%s'..." Scribunto text/plain local p = {} local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false local lists = { plainlist_t = { patterns = { '^plainlist$', '%splainlist$', '^plainlist%s', '%splainlist%s' }, found = false, styles = 'Plainlist/styles.css' }, hlist_t = { patterns = { '^hlist$', '%shlist$', '^hlist%s', '%shlist%s' }, found = false, styles = 'Hlist/styles.css' } } local function has_list_class(args_to_check) for _, list in pairs(lists) do if not list.found then for _, arg in pairs(args_to_check) do for _, pattern in ipairs(list.patterns) do if mw.ustring.find(arg or '', pattern) then list.found = true break end end if list.found then break end end end end end local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = '' while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '') s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = '' for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = '' end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- [[Special:Diff/849054481]] -- remove when [[:phab:T191516]] is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end -- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '') end end -- Returns the union of the values of two tables, as a sequence. local function union(t1, t2) local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end -- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end -- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs) if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass }) root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( '[[Category:Pages using infobox templates with ignored data cells]]' ) end elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class }) local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or '') end end local function renderTitle() if not args.title then return end has_rows = true has_list_class({args.titleclass}) root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end local function renderAboveRow() if not args.above then return end has_rows = true has_list_class({ args.aboveclass }) root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end local function renderBelowRow() if not args.below then return end has_rows = true has_list_class({ args.belowclass }) root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ subheaderArgs.rowclass, subheaderArgs.class }) local row = root:tag('tr') row:addClass(subheaderArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or '') end end local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end local function addImageRow(imageArgs) if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ imageArgs.rowclass, imageArgs.class }) local row = root:tag('tr') row:addClass(imageArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or '') end end local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end -- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, '' ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ''):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end -- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows() local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end local function renderNavBar() if not args.name then return end has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(require('Module:Italic title')._main({})) end end -- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end -- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( '[[Category:Pages using embedded infobox templates with the title parameter]]' ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext('[[Category:Articles using infobox templates with no data rows]]') end end --[=[ Loads the templatestyles for the infobox. TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar. ]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame() local hlist_templatestyles = '' if lists.hlist_t.found then hlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.hlist_t.styles } } end local plainlist_templatestyles = '' if lists.plainlist_t.found then plainlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.plainlist_t.styles } } end -- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } } local templatestyles = '' if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end local child_templatestyles = '' if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end local grandchild_templatestyles = '' if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end return table.concat({ -- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering. -- this ordering is not a guarantee because the rows of interest invoking -- each class may not be on a specific page hlist_templatestyles, plainlist_templatestyles, base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles }) end -- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end -- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table') root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle) has_list_class({ args.bodyclass }) renderTitle() renderAboveRow() else root = mw.html.create() root :wikitext(args.title) end structure_infobox_common() return loadTemplateStyles() .. root end -- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= '' then args[argName] = origArgs[argName] end end -- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end -- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end -- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end -- Parse the data parameters in the same order that the old {{infobox}} did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters() preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end parseDataParameters() return _infobox() end -- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end parseDataParameters() return _infobox() end return p 0ddb7e5c8426d67cd589b710efb9912ddfb67fea Template:Infobox settlement/styles.css 10 6 24 2023-12-17T11:34:47Z BaiatArbore 2 BaiatArbore created the page [[Template:Infobox settlement/styles.css]] using a non-default content model "CSS": Did not work with sanitized css css text/css da39a3ee5e6b4b0d3255bfef95601890afd80709 25 24 2023-12-17T11:35:00Z BaiatArbore 2 css text/css /* {{pp|small=y}} */ .ib-settlement { width: 23em; border-collapse: collapse; line-height: 1.2em; } /* TODO split definitions to appropriate class names when live from HTML element */ .ib-settlement td, .ib-settlement th { border-top: 1px solid #a2a9b1; padding: 0.4em 0.6em 0.4em 0.6em; } .ib-settlement .mergedtoprow .infobox-full-data, .ib-settlement .mergedtoprow .infobox-header, .ib-settlement .mergedtoprow .infobox-data, .ib-settlement .mergedtoprow .infobox-label, .ib-settlement .mergedtoprow .infobox-below { border-top: 1px solid #a2a9b1; padding: 0.4em 0.6em 0.2em 0.6em; } .ib-settlement .mergedrow .infobox-full-data, .ib-settlement .mergedrow .infobox-data, .ib-settlement .mergedrow .infobox-label { border: 0; padding: 0 0.6em 0.2em 0.6em; } .ib-settlement .mergedbottomrow .infobox-full-data, .ib-settlement .mergedbottomrow .infobox-data, .ib-settlement .mergedbottomrow .infobox-label { border-top: 0; border-bottom: 1px solid #a2a9b1; padding: 0 0.6em 0.4em 0.6em; } .ib-settlement .maptable { border: 0; padding: 0; } .ib-settlement .infobox-header, .ib-settlement .infobox-below { text-align: left; } .ib-settlement .infobox-above { font-size: 125%; line-height: 1.3em; } .ib-settlement .infobox-subheader { background-color: #cddeff; font-weight: bold; } .ib-settlement-native { font-weight: normal; padding-top: 0.2em; } .ib-settlement-other-name { font-size: 78%; } .ib-settlement-official { font-weight: bold; } .ib-settlement-caption { padding: 0.3em 0 0 0; } .ib-settlement-caption-link { padding: 0.2em 0; } .ib-settlement-nickname { display: inline; } .ib-settlement-fn { font-weight: normal; display: inline; } bcad428737f5a62eb7bced25a38fccbd46dde186 Module:Infobox/styles.css 828 7 26 2023-12-17T11:37:40Z BaiatArbore 2 Created page with "/* {{pp|small=y}} */ /* * This TemplateStyles sheet deliberately does NOT include the full set of * infobox styles. We are still working to migrate all of the manual * infoboxes. See [[MediaWiki talk:Common.css/to do#Infobox]] * DO NOT ADD THEM HERE */ /* * not strictly certain these styles are necessary since the modules now * exclusively output infobox-subbox or infobox, not both * just replicating the module faithfully */ .infobox-subbox { padding: 0; borde..." sanitized-css text/css /* {{pp|small=y}} */ /* * This TemplateStyles sheet deliberately does NOT include the full set of * infobox styles. We are still working to migrate all of the manual * infoboxes. See [[MediaWiki talk:Common.css/to do#Infobox]] * DO NOT ADD THEM HERE */ /* * not strictly certain these styles are necessary since the modules now * exclusively output infobox-subbox or infobox, not both * just replicating the module faithfully */ .infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; } .infobox-3cols-child { margin: auto; } .infobox .navbar { font-size: 100%; } /* T281642 */ body.skin-minerva .infobox-header, body.skin-minerva .infobox-subheader, body.skin-minerva .infobox-above, body.skin-minerva .infobox-title, body.skin-minerva .infobox-image, body.skin-minerva .infobox-full-data, body.skin-minerva .infobox-below { text-align: center; } e8de6d96f4fde53afc4a6b0fed534405ab59b0a7 Template:Hlist/styles.css 10 8 27 2023-12-17T11:38:57Z BaiatArbore 2 Created page with "/* {{pp-protected|reason=match parent|small=yes}} */ /* * hlist styles are defined in core and Minerva and differ in Minerva. The * current definitions here (2023-01-01) are sufficient to override Minerva * without use of the hlist-separated class. The most problematic styles were * related to margin, padding, and the bullet. Check files listed at * [[MediaWiki talk:Common.css/to do#hlist-separated]] */ /* * TODO: When the majority of readership supports it (or s..." sanitized-css text/css /* {{pp-protected|reason=match parent|small=yes}} */ /* * hlist styles are defined in core and Minerva and differ in Minerva. The * current definitions here (2023-01-01) are sufficient to override Minerva * without use of the hlist-separated class. The most problematic styles were * related to margin, padding, and the bullet. Check files listed at * [[MediaWiki talk:Common.css/to do#hlist-separated]] */ /* * TODO: When the majority of readership supports it (or some beautiful world * in which grade C support is above the minimum threshold), use :is() */ .hlist dl, .hlist ol, .hlist ul { margin: 0; padding: 0; } /* Display list items inline */ .hlist dd, .hlist dt, .hlist li { /* * don't trust the note that says margin doesn't work with inline * removing margin: 0 makes dds have margins again * We also want to reset margin-right in Minerva */ margin: 0; display: inline; } /* Display requested top-level lists inline */ .hlist.inline, .hlist.inline dl, .hlist.inline ol, .hlist.inline ul, /* Display nested lists inline */ .hlist dl dl, .hlist dl ol, .hlist dl ul, .hlist ol dl, .hlist ol ol, .hlist ol ul, .hlist ul dl, .hlist ul ol, .hlist ul ul { display: inline; } /* Hide empty list items */ .hlist .mw-empty-li { display: none; } /* TODO: :not() can maybe be used here to remove the later rule. naive test * seems to work. more testing needed. like so: *.hlist dt:not(:last-child)::after { * content: ": "; *} *.hlist dd:not(:last-child)::after, *.hlist li:not(:last-child)::after { * content: " · "; * font-weight: bold; *} */ /* Generate interpuncts */ .hlist dt::after { content: ": "; } .hlist dd::after, .hlist li::after { content: " · "; font-weight: bold; } .hlist dd:last-child::after, .hlist dt:last-child::after, .hlist li:last-child::after { content: none; } /* Add parentheses around nested lists */ .hlist dd dd:first-child::before, .hlist dd dt:first-child::before, .hlist dd li:first-child::before, .hlist dt dd:first-child::before, .hlist dt dt:first-child::before, .hlist dt li:first-child::before, .hlist li dd:first-child::before, .hlist li dt:first-child::before, .hlist li li:first-child::before { content: " ("; font-weight: normal; } .hlist dd dd:last-child::after, .hlist dd dt:last-child::after, .hlist dd li:last-child::after, .hlist dt dd:last-child::after, .hlist dt dt:last-child::after, .hlist dt li:last-child::after, .hlist li dd:last-child::after, .hlist li dt:last-child::after, .hlist li li:last-child::after { content: ")"; font-weight: normal; } /* Put ordinals in front of ordered list items */ .hlist ol { counter-reset: listitem; } .hlist ol > li { counter-increment: listitem; } .hlist ol > li::before { content: " " counter(listitem) "\a0"; } .hlist dd ol > li:first-child::before, .hlist dt ol > li:first-child::before, .hlist li ol > li:first-child::before { content: " (" counter(listitem) "\a0"; } 8c9dd9c9c00f30eead17fe10f51d183333e81f33 28 27 2023-12-17T11:39:56Z BaiatArbore 2 BaiatArbore moved page [[Template:Hlist/style.css]] to [[Template:Hlist/styles.css]] without leaving a redirect: Misspelled title sanitized-css text/css /* {{pp-protected|reason=match parent|small=yes}} */ /* * hlist styles are defined in core and Minerva and differ in Minerva. The * current definitions here (2023-01-01) are sufficient to override Minerva * without use of the hlist-separated class. The most problematic styles were * related to margin, padding, and the bullet. Check files listed at * [[MediaWiki talk:Common.css/to do#hlist-separated]] */ /* * TODO: When the majority of readership supports it (or some beautiful world * in which grade C support is above the minimum threshold), use :is() */ .hlist dl, .hlist ol, .hlist ul { margin: 0; padding: 0; } /* Display list items inline */ .hlist dd, .hlist dt, .hlist li { /* * don't trust the note that says margin doesn't work with inline * removing margin: 0 makes dds have margins again * We also want to reset margin-right in Minerva */ margin: 0; display: inline; } /* Display requested top-level lists inline */ .hlist.inline, .hlist.inline dl, .hlist.inline ol, .hlist.inline ul, /* Display nested lists inline */ .hlist dl dl, .hlist dl ol, .hlist dl ul, .hlist ol dl, .hlist ol ol, .hlist ol ul, .hlist ul dl, .hlist ul ol, .hlist ul ul { display: inline; } /* Hide empty list items */ .hlist .mw-empty-li { display: none; } /* TODO: :not() can maybe be used here to remove the later rule. naive test * seems to work. more testing needed. like so: *.hlist dt:not(:last-child)::after { * content: ": "; *} *.hlist dd:not(:last-child)::after, *.hlist li:not(:last-child)::after { * content: " · "; * font-weight: bold; *} */ /* Generate interpuncts */ .hlist dt::after { content: ": "; } .hlist dd::after, .hlist li::after { content: " · "; font-weight: bold; } .hlist dd:last-child::after, .hlist dt:last-child::after, .hlist li:last-child::after { content: none; } /* Add parentheses around nested lists */ .hlist dd dd:first-child::before, .hlist dd dt:first-child::before, .hlist dd li:first-child::before, .hlist dt dd:first-child::before, .hlist dt dt:first-child::before, .hlist dt li:first-child::before, .hlist li dd:first-child::before, .hlist li dt:first-child::before, .hlist li li:first-child::before { content: " ("; font-weight: normal; } .hlist dd dd:last-child::after, .hlist dd dt:last-child::after, .hlist dd li:last-child::after, .hlist dt dd:last-child::after, .hlist dt dt:last-child::after, .hlist dt li:last-child::after, .hlist li dd:last-child::after, .hlist li dt:last-child::after, .hlist li li:last-child::after { content: ")"; font-weight: normal; } /* Put ordinals in front of ordered list items */ .hlist ol { counter-reset: listitem; } .hlist ol > li { counter-increment: listitem; } .hlist ol > li::before { content: " " counter(listitem) "\a0"; } .hlist dd ol > li:first-child::before, .hlist dt ol > li:first-child::before, .hlist li ol > li:first-child::before { content: " (" counter(listitem) "\a0"; } 8c9dd9c9c00f30eead17fe10f51d183333e81f33 Template:Plainlist/styles.css 10 9 29 2023-12-17T11:40:19Z BaiatArbore 2 Created page with "/* {{pp-template|small=yes}} */ .plainlist ol, .plainlist ul { line-height: inherit; list-style: none; margin: 0; padding: 0; /* Reset Minerva default */ } .plainlist ol li, .plainlist ul li { margin-bottom: 0; }" sanitized-css text/css /* {{pp-template|small=yes}} */ .plainlist ol, .plainlist ul { line-height: inherit; list-style: none; margin: 0; padding: 0; /* Reset Minerva default */ } .plainlist ol li, .plainlist ul li { margin-bottom: 0; } 51706efa229ff8794c0d94f260a208e7c5e6ec30 Module:Navbar 828 10 30 2023-12-17T11:41:21Z BaiatArbore 2 Created page with "local p = {} local cfg = mw.loadData('Module:Navbar/configuration') local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false..." Scribunto text/plain local p = {} local cfg = mw.loadData('Module:Navbar/configuration') local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end return show end local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', '', ']'} else l = {'[[', '|', ']]'} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style) local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or '' -- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = 'Special:EditPage/' .. title.fullText, ['url'] = false }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = 'Special:PageHistory/' .. title.fullText, ['url'] = false }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } } local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done() end function p._navbar(args) -- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or '') .. '; color: ' .. font_color .. ';' end end local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style) if is_mini then div:addClass(cfg.classes.mini) end local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list) if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end local frame = mw.getCurrentFrame() -- hlist -> navbar is best-effort to preserve old Common.css ordering. return frame:extensionTag{ name = 'templatestyles', args = { src = cfg.hlist_templatestyles } } .. frame:extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end function p.navbar(frame) return p._navbar(require('Module:Arguments').getArgs(frame)) end return p 047f307758c878eb3e99ed1768cc40920a6ec5fa Module:Navbar/configuration 828 11 31 2023-12-17T11:41:57Z BaiatArbore 2 Created page with "return { ['templatestyles'] = 'Module:Navbar/styles.css', ['hlist_templatestyles'] = 'Hlist/styles.css', ['box_text'] = 'This box: ', -- default text box when not plain or mini ['title_namespace'] = 'Template', -- namespace to default to for title ['invalid_title'] = 'Invalid title ', ['classes'] = { -- set a line to nil if you don't want it ['navbar'] = 'navbar', ['plainlinks'] = 'plainlinks', -- plainlinks ['horizontal_list'] = 'hlist', -- horizontal lis..." Scribunto text/plain return { ['templatestyles'] = 'Module:Navbar/styles.css', ['hlist_templatestyles'] = 'Hlist/styles.css', ['box_text'] = 'This box: ', -- default text box when not plain or mini ['title_namespace'] = 'Template', -- namespace to default to for title ['invalid_title'] = 'Invalid title ', ['classes'] = { -- set a line to nil if you don't want it ['navbar'] = 'navbar', ['plainlinks'] = 'plainlinks', -- plainlinks ['horizontal_list'] = 'hlist', -- horizontal list class ['mini'] = 'navbar-mini', -- class indicating small links in the navbar ['this_box'] = 'navbar-boxtext', ['brackets'] = 'navbar-brackets', -- 'collapsible' is the key for a class to indicate the navbar is -- setting up the collapsible element in addition to the normal -- navbar. ['collapsible'] = 'navbar-collapse', ['collapsible_title_mini'] = 'navbar-ct-mini', ['collapsible_title_full'] = 'navbar-ct-full' } } b007c336b17ec4bcd4d5a9dca9f8cba301662b55 Module:Navbar/styles.css 828 12 32 2023-12-17T11:42:23Z BaiatArbore 2 Created page with "/* {{pp|small=yes}} */ .navbar { display: inline; font-size: 88%; font-weight: normal; } .navbar-collapse { float: left; text-align: left; } .navbar-boxtext { word-spacing: 0; } .navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; } .navbar-brackets::before { margin-right: -0.125em; content: '[ '; } .navbar-brackets::after { margin-left: -0.125em; content: ' ]'; } .navbar li { word-spacing: -0.125em; } .navbar a > span, .nav..." sanitized-css text/css /* {{pp|small=yes}} */ .navbar { display: inline; font-size: 88%; font-weight: normal; } .navbar-collapse { float: left; text-align: left; } .navbar-boxtext { word-spacing: 0; } .navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; } .navbar-brackets::before { margin-right: -0.125em; content: '[ '; } .navbar-brackets::after { margin-left: -0.125em; content: ' ]'; } .navbar li { word-spacing: -0.125em; } .navbar a > span, .navbar a > abbr { text-decoration: inherit; } .navbar-mini abbr { font-variant: small-caps; border-bottom: none; text-decoration: none; cursor: inherit; } .navbar-ct-full { font-size: 114%; margin: 0 7em; } .navbar-ct-mini { font-size: 114%; margin: 0 4em; } 9d4056f949b4f0b159e3d40dfb1a5f01e72f9571 Module:Arguments 828 13 33 2023-12-17T11:43:02Z BaiatArbore 2 Created page with "-- This module provides easy processing of arguments passed to Scribunto from -- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly. local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local arguments = {} -- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it. local function tidyValDefault(key, val) if type(val) == 'string'..." Scribunto text/plain -- This module provides easy processing of arguments passed to Scribunto from -- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly. local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local arguments = {} -- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it. local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == '' then return nil else return val end else return val end end local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end local function tidyValNoChange(key, val) return val end local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end local translate_mt = { __index = function(t, k) return k end } function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {} --[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end --[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', '') local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end -- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end -- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs --[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end --[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable) local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end --[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]] metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end return args end return arguments 3134ecce8429b810d445e29eae115e2ae4c36c53 Module:TableTools 828 14 34 2023-12-17T11:43:39Z BaiatArbore 2 Created page with "------------------------------------------------------------------------------------ -- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke...." Scribunto text/plain ------------------------------------------------------------------------------------ -- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke. -- ------------------------------------------------------------------------------------ local libraryUtil = require('libraryUtil') local p = {} -- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType local checkTypeMulti = libraryUtil.checkTypeMulti ------------------------------------------------------------------------------------ -- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table. ------------------------------------------------------------------------------------ function p.isPositiveInteger(v) return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity end ------------------------------------------------------------------------------------ -- isNan -- -- This function returns true if the given number is a NaN value, and false if -- not. Although it doesn't operate on tables, it is included here as it is useful -- for determining whether a value can be a valid table key. Lua will generate an -- error if a NaN is used as a table key. ------------------------------------------------------------------------------------ function p.isNan(v) return type(v) == 'number' and v ~= v end ------------------------------------------------------------------------------------ -- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own. ------------------------------------------------------------------------------------ function p.shallowClone(t) checkType('shallowClone', 1, t, 'table') local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end ------------------------------------------------------------------------------------ -- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged. ------------------------------------------------------------------------------------ function p.removeDuplicates(arr) checkType('removeDuplicates', 1, arr, 'table') local isNan = p.isNan local ret, exists = {}, {} for _, v in ipairs(arr) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v else if not exists[v] then ret[#ret + 1] = v exists[v] = true end end end return ret end ------------------------------------------------------------------------------------ -- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order. ------------------------------------------------------------------------------------ function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end ------------------------------------------------------------------------------------ -- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return -- {1, 3, 6}. ------------------------------------------------------------------------------------ function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true) local function cleanPattern(s) -- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally. return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') end prefix = prefix or '' suffix = suffix or '' prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$' local nums = {} for k in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end ------------------------------------------------------------------------------------ -- numData -- -- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table -- of subtables in the format -- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}. -- Keys that don't end with an integer are stored in a subtable named "other". The -- compress option compresses the table so that it can be iterated over with -- ipairs. ------------------------------------------------------------------------------------ function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == '' then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end ------------------------------------------------------------------------------------ -- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs. ------------------------------------------------------------------------------------ function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end ------------------------------------------------------------------------------------ -- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values. ------------------------------------------------------------------------------------ function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function () i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end ------------------------------------------------------------------------------------ -- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the # operator. ------------------------------------------------------------------------------------ function p.size(t) checkType('size', 1, t, 'table') local i = 0 for _ in pairs(t) do i = i + 1 end return i end local function defaultKeySort(item1, item2) -- "number" < "string", so numbers will be sorted before strings. local type1, type2 = type(item1), type(item2) if type1 ~= type2 then return type1 < type2 elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then return tostring(item1) < tostring(item2) else return item1 < item2 end end ------------------------------------------------------------------------------------ -- keysToList -- -- Returns an array of the keys in a table, sorted using either a default -- comparison function or a custom keySort function. ------------------------------------------------------------------------------------ function p.keysToList(t, keySort, checked) if not checked then checkType('keysToList', 1, t, 'table') checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'}) end local arr = {} local index = 1 for k in pairs(t) do arr[index] = k index = index + 1 end if keySort ~= false then keySort = type(keySort) == 'function' and keySort or defaultKeySort table.sort(arr, keySort) end return arr end ------------------------------------------------------------------------------------ -- sortedPairs -- -- Iterates through a table, with the keys sorted using the keysToList function. -- If there are only numerical keys, sparseIpairs is probably more efficient. ------------------------------------------------------------------------------------ function p.sortedPairs(t, keySort) checkType('sortedPairs', 1, t, 'table') checkType('sortedPairs', 2, keySort, 'function', true) local arr = p.keysToList(t, keySort, true) local i = 0 return function () i = i + 1 local key = arr[i] if key ~= nil then return key, t[key] else return nil, nil end end end ------------------------------------------------------------------------------------ -- isArray -- -- Returns true if the given value is a table and all keys are consecutive -- integers starting at 1. ------------------------------------------------------------------------------------ function p.isArray(v) if type(v) ~= 'table' then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end ------------------------------------------------------------------------------------ -- isArrayLike -- -- Returns true if the given value is iterable and all keys are consecutive -- integers starting at 1. ------------------------------------------------------------------------------------ function p.isArrayLike(v) if not pcall(pairs, v) then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end ------------------------------------------------------------------------------------ -- invert -- -- Transposes the keys and values in an array. For example, {"a", "b", "c"} -> -- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to -- the index of the last duplicate) and NaN values are ignored. ------------------------------------------------------------------------------------ function p.invert(arr) checkType("invert", 1, arr, "table") local isNan = p.isNan local map = {} for i, v in ipairs(arr) do if not isNan(v) then map[v] = i end end return map end ------------------------------------------------------------------------------------ -- listToSet -- -- Creates a set from the array part of the table. Indexing the set by any of the -- values of the array returns true. For example, {"a", "b", "c"} -> -- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them -- never equal to any value (including other NaNs or even themselves). ------------------------------------------------------------------------------------ function p.listToSet(arr) checkType("listToSet", 1, arr, "table") local isNan = p.isNan local set = {} for _, v in ipairs(arr) do if not isNan(v) then set[v] = true end end return set end ------------------------------------------------------------------------------------ -- deepCopy -- -- Recursive deep copy function. Preserves identities of subtables. ------------------------------------------------------------------------------------ local function _deepCopy(orig, includeMetatable, already_seen) -- Stores copies of tables indexed by the original table. already_seen = already_seen or {} local copy = already_seen[orig] if copy ~= nil then return copy end if type(orig) == 'table' then copy = {} for orig_key, orig_value in pairs(orig) do copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen) end already_seen[orig] = copy if includeMetatable then local mt = getmetatable(orig) if mt ~= nil then local mt_copy = _deepCopy(mt, includeMetatable, already_seen) setmetatable(copy, mt_copy) already_seen[mt] = mt_copy end end else -- number, string, boolean, etc copy = orig end return copy end function p.deepCopy(orig, noMetatable, already_seen) checkType("deepCopy", 3, already_seen, "table", true) return _deepCopy(orig, not noMetatable, already_seen) end ------------------------------------------------------------------------------------ -- sparseConcat -- -- Concatenates all values in the table that are indexed by a number, in order. -- sparseConcat{a, nil, c, d} => "acd" -- sparseConcat{nil, b, c, d} => "bcd" ------------------------------------------------------------------------------------ function p.sparseConcat(t, sep, i, j) local arr = {} local arr_i = 0 for _, v in p.sparseIpairs(t) do arr_i = arr_i + 1 arr[arr_i] = v end return table.concat(arr, sep, i, j) end ------------------------------------------------------------------------------------ -- length -- -- Finds the length of an array, or of a quasi-array with keys such as "data1", -- "data2", etc., using an exponential search algorithm. It is similar to the -- operator #, but may return a different value when there are gaps in the array -- portion of the table. Intended to be used on data loaded with mw.loadData. For -- other tables, use #. -- Note: #frame.args in frame object always be set to 0, regardless of the number -- of unnamed template parameters, so use this function for frame.args. ------------------------------------------------------------------------------------ function p.length(t, prefix) -- requiring module inline so that [[Module:Exponential search]] which is -- only needed by this one function doesn't get millions of transclusions local expSearch = require("Module:Exponential search") checkType('length', 1, t, 'table') checkType('length', 2, prefix, 'string', true) return expSearch(function (i) local key if prefix then key = prefix .. tostring(i) else key = i end return t[key] ~= nil end) or 0 end ------------------------------------------------------------------------------------ -- inArray -- -- Returns true if valueToFind is a member of the array, and false otherwise. ------------------------------------------------------------------------------------ function p.inArray(arr, valueToFind) checkType("inArray", 1, arr, "table") -- if valueToFind is nil, error? for _, v in ipairs(arr) do if v == valueToFind then return true end end return false end return p 085e7094ac84eb0132ee65822cf3f69cd8ba3d81 Module:Exponential search 828 15 35 2023-12-17T11:44:21Z BaiatArbore 2 Created page with "-- This module provides a generic exponential search algorithm. require[[strict]] local checkType = require('libraryUtil').checkType local floor = math.floor local function midPoint(lower, upper) return floor(lower + (upper - lower) / 2) end local function search(testFunc, i, lower, upper) if testFunc(i) then if i + 1 == upper then return i end lower = i if upper then i = midPoint(lower, upper) else i = i * 2 end return search(testFunc, i, low..." Scribunto text/plain -- This module provides a generic exponential search algorithm. require[[strict]] local checkType = require('libraryUtil').checkType local floor = math.floor local function midPoint(lower, upper) return floor(lower + (upper - lower) / 2) end local function search(testFunc, i, lower, upper) if testFunc(i) then if i + 1 == upper then return i end lower = i if upper then i = midPoint(lower, upper) else i = i * 2 end return search(testFunc, i, lower, upper) else upper = i i = midPoint(lower, upper) return search(testFunc, i, lower, upper) end end return function (testFunc, init) checkType('Exponential search', 1, testFunc, 'function') checkType('Exponential search', 2, init, 'number', true) if init and (init < 1 or init ~= floor(init) or init == math.huge) then error(string.format( "invalid init value '%s' detected in argument #2 to " .. "'Exponential search' (init value must be a positive integer)", tostring(init) ), 2) end init = init or 2 if not testFunc(1) then return nil end return search(testFunc, init, 1, nil) end a9037be0c44536be79b2d7a26155bfb907368ae7 Module:Italic title 828 16 36 2023-12-17T11:45:40Z BaiatArbore 2 Created page with "-- This module implements {{italic title}}. require('strict') local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local yesno = require('Module:Yesno') -------------------------------------------------------------------------------- -- ItalicTitle class -------------------------------------------------------------------------------- local ItalicTitle = {} do ----------------..." Scribunto text/plain -- This module implements {{italic title}}. require('strict') local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local yesno = require('Module:Yesno') -------------------------------------------------------------------------------- -- ItalicTitle class -------------------------------------------------------------------------------- local ItalicTitle = {} do ---------------------------------------------------------------------------- -- Class attributes and functions -- Things that belong to the class are here. Things that belong to each -- object are in the constructor. ---------------------------------------------------------------------------- -- Keys of title parts that can be italicized. local italicizableKeys = { namespace = true, title = true, dab = true, } ---------------------------------------------------------------------------- -- ItalicTitle constructor -- This contains all the dynamic attributes and methods. ---------------------------------------------------------------------------- function ItalicTitle.new() local obj = {} -- Function for checking self variable in methods. local checkSelf = libraryUtil.makeCheckSelfFunction( 'ItalicTitle', 'obj', obj, 'ItalicTitle object' ) -- Checks a key is present in a lookup table. -- Param: name - the function name. -- Param: argId - integer position of the key in the argument list. -- Param: key - the key. -- Param: lookupTable - the table to look the key up in. local function checkKey(name, argId, key, lookupTable) if not lookupTable[key] then error(string.format( "bad argument #%d to '%s' ('%s' is not a valid key)", argId, name, key ), 3) end end -- Set up object structure. local parsed = false local categories = {} local italicizedKeys = {} local italicizedSubstrings = {} -- Parses a title object into its namespace text, title, and -- disambiguation text. -- Param: options - a table of options with the following keys: -- title - the title object to parse -- ignoreDab - ignore any disambiguation parentheses -- Returns the current object. function obj:parseTitle(options) checkSelf(self, 'parseTitle') checkType('parseTitle', 1, options, 'table') checkTypeForNamedArg('parseTitle', 'title', options.title, 'table') local title = options.title -- Title and dab text local prefix, parentheses if not options.ignoreDab then prefix, parentheses = mw.ustring.match( title.text, '^(.+) %(([^%(%)]+)%)$' ) end if prefix and parentheses then self.title = prefix self.dab = parentheses else self.title = title.text end -- Namespace local namespace = mw.site.namespaces[title.namespace].name if namespace and #namespace >= 1 then self.namespace = namespace end -- Register the object as having parsed a title. parsed = true return self end -- Italicizes part of the title. -- Param: key - the key of the title part to be italicized. Possible -- keys are contained in the italicizableKeys table. -- Returns the current object. function obj:italicize(key) checkSelf(self, 'italicize') checkType('italicize', 1, key, 'string') checkKey('italicize', 1, key, italicizableKeys) italicizedKeys[key] = true return self end -- Un-italicizes part of the title. -- Param: key - the key of the title part to be un-italicized. Possible -- keys are contained in the italicizableKeys table. -- Returns the current object. function obj:unitalicize(key) checkSelf(self, 'unitalicize') checkType('unitalicize', 1, key, 'string') checkKey('unitalicize', 1, key, italicizableKeys) italicizedKeys[key] = nil return self end -- Italicizes a substring in the title. This only affects the main part -- of the title, not the namespace or the disambiguation text. -- Param: s - the substring to be italicized. -- Returns the current object. function obj:italicizeSubstring(s) checkSelf(self, 'italicizeSubstring') checkType('italicizeSubstring', 1, s, 'string') italicizedSubstrings[s] = true return self end -- Un-italicizes a substring in the title. This only affects the main -- part of the title, not the namespace or the disambiguation text. -- Param: s - the substring to be un-italicized. -- Returns the current object. function obj:unitalicizeSubstring(s) checkSelf(self, 'unitalicizeSubstring') checkType('unitalicizeSubstring', 1, s, 'string') italicizedSubstrings[s] = nil return self end -- Renders the object into a page name. If no title has yet been parsed, -- the current title is used. -- Returns string function obj:renderTitle() checkSelf(self, 'renderTitle') -- Italicizes a string -- Param: s - the string to italicize -- Returns string. local function italicize(s) assert(type(s) == 'string', 's was not a string') assert(s ~= '', 's was the empty string') return string.format('<i>%s</i>', s) end -- Escape characters in a string that are magic in Lua patterns. -- Param: pattern - the pattern to escape -- Returns string. local function escapeMagicCharacters(s) assert(type(s) == 'string', 's was not a string') return s:gsub('%p', '%%%0') end -- If a title hasn't been parsed yet, parse the current title. if not parsed then self:parseTitle{title = mw.title.getCurrentTitle()} end -- Italicize the different parts of the title and store them in a -- titleParts table to be joined together later. local titleParts = {} -- Italicize the italicizable keys. for key in pairs(italicizableKeys) do if self[key] then if italicizedKeys[key] then titleParts[key] = italicize(self[key]) else titleParts[key] = self[key] end end end -- Italicize substrings. If there are any substrings to be -- italicized then start from the raw title, as this overrides any -- italicization of the main part of the title. if next(italicizedSubstrings) then titleParts.title = self.title for s in pairs(italicizedSubstrings) do local pattern = escapeMagicCharacters(s) local italicizedTitle, nReplacements = titleParts.title:gsub( pattern, italicize ) titleParts.title = italicizedTitle -- If we didn't make any replacements then it means that we -- have been passed a bad substring or that the page has -- been moved to a bad title, so add a tracking category. if nReplacements < 1 then categories['Pages using italic title with no matching string'] = true end end end -- Assemble the title together from the parts. local ret = '' if titleParts.namespace then ret = ret .. titleParts.namespace .. ':' end ret = ret .. titleParts.title if titleParts.dab then ret = ret .. ' (' .. titleParts.dab .. ')' end return ret end -- Returns an expanded DISPLAYTITLE parser function called with the -- result of obj:renderTitle, plus any other optional arguments. -- Returns string function obj:renderDisplayTitle(...) checkSelf(self, 'renderDisplayTitle') return mw.getCurrentFrame():callParserFunction( 'DISPLAYTITLE', self:renderTitle(), ... ) end -- Returns an expanded DISPLAYTITLE parser function called with the -- result of obj:renderTitle, plus any other optional arguments, plus -- any tracking categories. -- Returns string function obj:render(...) checkSelf(self, 'render') local ret = self:renderDisplayTitle(...) for cat in pairs(categories) do ret = ret .. string.format( '[[Category:%s]]', cat ) end return ret end return obj end end -------------------------------------------------------------------------------- -- Exports -------------------------------------------------------------------------------- local p = {} local function getArgs(frame, wrapper) assert(type(wrapper) == 'string', 'wrapper was not a string') return require('Module:Arguments').getArgs(frame, { wrappers = wrapper }) end -- Main function for {{italic title}} function p._main(args) checkType('_main', 1, args, 'table') local italicTitle = ItalicTitle.new() italicTitle:parseTitle{ title = mw.title.getCurrentTitle(), ignoreDab = yesno(args.all, false) } if args.string then italicTitle:italicizeSubstring(args.string) else italicTitle:italicize('title') end return italicTitle:render(args[1]) end function p.main(frame) return p._main(getArgs(frame, 'Template:Italic title')) end function p._dabonly(args) return ItalicTitle.new() :italicize('dab') :render(args[1]) end function p.dabonly(frame) return p._dabonly(getArgs(frame, 'Template:Italic dab')) end return p 9b49016c8f526f680e9ecdaf36ec4ceafda2a2f8 Module:Yesno 828 17 37 2023-12-17T11:46:06Z BaiatArbore 2 Created page with "-- Function allowing for consistent treatment of boolean-like wikitext input. -- It works similarly to the template {{yesno}}. return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val =..." Scribunto text/plain -- Function allowing for consistent treatment of boolean-like wikitext input. -- It works similarly to the template {{yesno}}. return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end f767643e7d12126d020d88d662a3dd057817b9dc Module:InfoboxImage 828 18 38 2023-12-17T11:47:16Z BaiatArbore 2 Created page with "-- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if th..." Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Female no free image yet.png", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female (blue).svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then return ""; end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = "[[Category:Pages using infoboxes with thumbnail images]]"; end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; 35066ee19938554ca6eeb18d6e22d2063336b7e1 Module:Math 828 19 39 2023-12-17T11:47:57Z BaiatArbore 2 Created page with "--[[ This module provides a number of basic mathematical operations. ]] local yesno, getArgs -- lazily initialized local p = {} -- Holds functions to be returned from #invoke, and functions to make available to other Lua modules. local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua. --[[ Helper functions used to avoid redundant code. ]] local function..." Scribunto text/plain --[[ This module provides a number of basic mathematical operations. ]] local yesno, getArgs -- lazily initialized local p = {} -- Holds functions to be returned from #invoke, and functions to make available to other Lua modules. local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua. --[[ Helper functions used to avoid redundant code. ]] local function err(msg) -- Generates wikitext error messages. return mw.ustring.format('<strong class="error">Formatting error: %s</strong>', msg) end local function unpackNumberArgs(args) -- Returns an unpacked list of arguments specified with numerical keys. local ret = {} for k, v in pairs(args) do if type(k) == 'number' then table.insert(ret, v) end end return unpack(ret) end local function makeArgArray(...) -- Makes an array of arguments from a list of arguments that might include nils. local args = {...} -- Table of arguments. It might contain nils or non-number values, so we can't use ipairs. local nums = {} -- Stores the numbers of valid numerical arguments. local ret = {} for k, v in pairs(args) do v = p._cleanNumber(v) if v then nums[#nums + 1] = k args[k] = v end end table.sort(nums) for i, num in ipairs(nums) do ret[#ret + 1] = args[num] end return ret end local function fold(func, ...) -- Use a function on all supplied arguments, and return the result. The function must accept two numbers as parameters, -- and must return a number as an output. This number is then supplied as input to the next function call. local vals = makeArgArray(...) local count = #vals -- The number of valid arguments if count == 0 then return -- Exit if we have no valid args, otherwise removing the first arg would cause an error. nil, 0 end local ret = table.remove(vals, 1) for _, val in ipairs(vals) do ret = func(ret, val) end return ret, count end --[[ Fold arguments by selectively choosing values (func should return when to choose the current "dominant" value). ]] local function binary_fold(func, ...) local value = fold((function(a, b) if func(a, b) then return a else return b end end), ...) return value end --[[ random Generate a random number Usage: {{#invoke: Math | random }} {{#invoke: Math | random | maximum value }} {{#invoke: Math | random | minimum value | maximum value }} ]] function wrap.random(args) local first = p._cleanNumber(args[1]) local second = p._cleanNumber(args[2]) return p._random(first, second) end function p._random(first, second) math.randomseed(mw.site.stats.edits + mw.site.stats.pages + os.time() + math.floor(os.clock() * 1000000000)) -- math.random will throw an error if given an explicit nil parameter, so we need to use if statements to check the params. if first and second then if first <= second then -- math.random doesn't allow the first number to be greater than the second. return math.random(first, second) end elseif first then return math.random(first) else return math.random() end end --[[ order Determine order of magnitude of a number Usage: {{#invoke: Math | order | value }} ]] function wrap.order(args) local input_string = (args[1] or args.x or '0'); local input_number = p._cleanNumber(input_string); if input_number == nil then return err('order of magnitude input appears non-numeric') else return p._order(input_number) end end function p._order(x) if x == 0 then return 0 end return math.floor(math.log10(math.abs(x))) end --[[ precision Detemines the precision of a number using the string representation Usage: {{ #invoke: Math | precision | value }} ]] function wrap.precision(args) local input_string = (args[1] or args.x or '0'); local trap_fraction = args.check_fraction; local input_number; if not yesno then yesno = require('Module:Yesno') end if yesno(trap_fraction, true) then -- Returns true for all input except nil, false, "no", "n", "0" and a few others. See [[Module:Yesno]]. local pos = string.find(input_string, '/', 1, true); if pos ~= nil then if string.find(input_string, '/', pos + 1, true) == nil then local denominator = string.sub(input_string, pos+1, -1); local denom_value = tonumber(denominator); if denom_value ~= nil then return math.log10(denom_value); end end end end input_number, input_string = p._cleanNumber(input_string); if input_string == nil then return err('precision input appears non-numeric') else return p._precision(input_string) end end function p._precision(x) if type(x) == 'number' then x = tostring(x) end x = string.upper(x) local decimal = x:find('%.') local exponent_pos = x:find('E') local result = 0; if exponent_pos ~= nil then local exponent = string.sub(x, exponent_pos + 1) x = string.sub(x, 1, exponent_pos - 1) result = result - tonumber(exponent) end if decimal ~= nil then result = result + string.len(x) - decimal return result end local pos = string.len(x); while x:byte(pos) == string.byte('0') do pos = pos - 1 result = result - 1 if pos <= 0 then return 0 end end return result end --[[ max Finds the maximum argument Usage: {{#invoke:Math| max | value1 | value2 | ... }} Note, any values that do not evaluate to numbers are ignored. ]] function wrap.max(args) return p._max(unpackNumberArgs(args)) end function p._max(...) local max_value = binary_fold((function(a, b) return a > b end), ...) if max_value then return max_value end end --[[ median Find the median of set of numbers Usage: {{#invoke:Math | median | number1 | number2 | ...}} OR {{#invoke:Math | median }} ]] function wrap.median(args) return p._median(unpackNumberArgs(args)) end function p._median(...) local vals = makeArgArray(...) local count = #vals table.sort(vals) if count == 0 then return 0 end if p._mod(count, 2) == 0 then return (vals[count/2] + vals[count/2+1])/2 else return vals[math.ceil(count/2)] end end --[[ min Finds the minimum argument Usage: {{#invoke:Math| min | value1 | value2 | ... }} OR {{#invoke:Math| min }} When used with no arguments, it takes its input from the parent frame. Note, any values that do not evaluate to numbers are ignored. ]] function wrap.min(args) return p._min(unpackNumberArgs(args)) end function p._min(...) local min_value = binary_fold((function(a, b) return a < b end), ...) if min_value then return min_value end end --[[ sum Finds the sum Usage: {{#invoke:Math| sum | value1 | value2 | ... }} OR {{#invoke:Math| sum }} Note, any values that do not evaluate to numbers are ignored. ]] function wrap.sum(args) return p._sum(unpackNumberArgs(args)) end function p._sum(...) local sums, count = fold((function(a, b) return a + b end), ...) if not sums then return 0 else return sums end end --[[ average Finds the average Usage: {{#invoke:Math| average | value1 | value2 | ... }} OR {{#invoke:Math| average }} Note, any values that do not evaluate to numbers are ignored. ]] function wrap.average(args) return p._average(unpackNumberArgs(args)) end function p._average(...) local sum, count = fold((function(a, b) return a + b end), ...) if not sum then return 0 else return sum / count end end --[[ round Rounds a number to specified precision Usage: {{#invoke:Math | round | value | precision }} --]] function wrap.round(args) local value = p._cleanNumber(args[1] or args.value or 0) local precision = p._cleanNumber(args[2] or args.precision or 0) if value == nil or precision == nil then return err('round input appears non-numeric') else return p._round(value, precision) end end function p._round(value, precision) local rescale = math.pow(10, precision or 0); return math.floor(value * rescale + 0.5) / rescale; end --[[ log10 returns the log (base 10) of a number Usage: {{#invoke:Math | log10 | x }} ]] function wrap.log10(args) return math.log10(args[1]) end --[[ mod Implements the modulo operator Usage: {{#invoke:Math | mod | x | y }} --]] function wrap.mod(args) local x = p._cleanNumber(args[1]) local y = p._cleanNumber(args[2]) if not x then return err('first argument to mod appears non-numeric') elseif not y then return err('second argument to mod appears non-numeric') else return p._mod(x, y) end end function p._mod(x, y) local ret = x % y if not (0 <= ret and ret < y) then ret = 0 end return ret end --[[ gcd Calculates the greatest common divisor of multiple numbers Usage: {{#invoke:Math | gcd | value 1 | value 2 | value 3 | ... }} --]] function wrap.gcd(args) return p._gcd(unpackNumberArgs(args)) end function p._gcd(...) local function findGcd(a, b) local r = b local oldr = a while r ~= 0 do local quotient = math.floor(oldr / r) oldr, r = r, oldr - quotient * r end if oldr < 0 then oldr = oldr * -1 end return oldr end local result, count = fold(findGcd, ...) return result end --[[ precision_format Rounds a number to the specified precision and formats according to rules originally used for {{template:Rnd}}. Output is a string. Usage: {{#invoke: Math | precision_format | number | precision }} ]] function wrap.precision_format(args) local value_string = args[1] or 0 local precision = args[2] or 0 return p._precision_format(value_string, precision) end function p._precision_format(value_string, precision) -- For access to Mediawiki built-in formatter. local lang = mw.getContentLanguage(); local value value, value_string = p._cleanNumber(value_string) precision = p._cleanNumber(precision) -- Check for non-numeric input if value == nil or precision == nil then return err('invalid input when rounding') end local current_precision = p._precision(value) local order = p._order(value) -- Due to round-off effects it is neccesary to limit the returned precision under -- some circumstances because the terminal digits will be inaccurately reported. if order + precision >= 14 then if order + p._precision(value_string) >= 14 then precision = 13 - order; end end -- If rounding off, truncate extra digits if precision < current_precision then value = p._round(value, precision) current_precision = p._precision(value) end local formatted_num = lang:formatNum(math.abs(value)) local sign -- Use proper unary minus sign rather than ASCII default if value < 0 then sign = '−' else sign = '' end -- Handle cases requiring scientific notation if string.find(formatted_num, 'E', 1, true) ~= nil or math.abs(order) >= 9 then value = value * math.pow(10, -order) current_precision = current_precision + order precision = precision + order formatted_num = lang:formatNum(math.abs(value)) else order = 0; end formatted_num = sign .. formatted_num -- Pad with zeros, if needed if current_precision < precision then local padding if current_precision <= 0 then if precision > 0 then local zero_sep = lang:formatNum(1.1) formatted_num = formatted_num .. zero_sep:sub(2,2) padding = precision if padding > 20 then padding = 20 end formatted_num = formatted_num .. string.rep('0', padding) end else padding = precision - current_precision if padding > 20 then padding = 20 end formatted_num = formatted_num .. string.rep('0', padding) end end -- Add exponential notation, if necessary. if order ~= 0 then -- Use proper unary minus sign rather than ASCII default if order < 0 then order = '−' .. lang:formatNum(math.abs(order)) else order = lang:formatNum(order) end formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>' end return formatted_num end --[[ divide Implements the division operator Usage: {{#invoke:Math | divide | x | y | round= | precision= }} --]] function wrap.divide(args) local x = args[1] local y = args[2] local round = args.round local precision = args.precision if not yesno then yesno = require('Module:Yesno') end return p._divide(x, y, yesno(round), precision) end function p._divide(x, y, round, precision) if y == nil or y == "" then return err("Empty divisor") elseif not tonumber(y) then if type(y) == 'string' and string.sub(y, 1, 1) == '<' then return y else return err("Not a number: " .. y) end elseif x == nil or x == "" then return err("Empty dividend") elseif not tonumber(x) then if type(x) == 'string' and string.sub(x, 1, 1) == '<' then return x else return err("Not a number: " .. x) end else local z = x / y if round then return p._round(z, 0) elseif precision then return p._round(z, precision) else return z end end end --[[ Helper function that interprets the input numerically. If the input does not appear to be a number, attempts evaluating it as a parser functions expression. ]] function p._cleanNumber(number_string) if type(number_string) == 'number' then -- We were passed a number, so we don't need to do any processing. return number_string, tostring(number_string) elseif type(number_string) ~= 'string' or not number_string:find('%S') then -- We were passed a non-string or a blank string, so exit. return nil, nil; end -- Attempt basic conversion local number = tonumber(number_string) -- If failed, attempt to evaluate input as an expression if number == nil then local success, result = pcall(mw.ext.ParserFunctions.expr, number_string) if success then number = tonumber(result) number_string = tostring(number) else number = nil number_string = nil end else number_string = number_string:match("^%s*(.-)%s*$") -- String is valid but may contain padding, clean it. number_string = number_string:match("^%+(.*)$") or number_string -- Trim any leading + signs. if number_string:find('^%-?0[xX]') then -- Number is using 0xnnn notation to indicate base 16; use the number that Lua detected instead. number_string = tostring(number) end end return number, number_string end --[[ Wrapper function that does basic argument processing. This ensures that all functions from #invoke can use either the current frame or the parent frame, and it also trims whitespace for all arguments and removes blank arguments. ]] local mt = { __index = function(t, k) return function(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return wrap[k](getArgs(frame)) -- Argument processing is left to Module:Arguments. Whitespace is trimmed and blank arguments are removed. end end } return setmetatable(p, mt) 2bbe734d898299f65412963a3c1782e9fcc4d9ca Module:Coordinates 828 20 40 2023-12-17T11:48:26Z BaiatArbore 2 Created page with "--[[ This module is intended to replace the functionality of {{Coord}} and related templates. It provides several methods, including {{#invoke:Coordinates | coord }} : General function formatting and displaying coordinate values. {{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal degree values to DMS format. {{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format to decimal degree format. {{#invoke:Coordinates | link }..." Scribunto text/plain --[[ This module is intended to replace the functionality of {{Coord}} and related templates. It provides several methods, including {{#invoke:Coordinates | coord }} : General function formatting and displaying coordinate values. {{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal degree values to DMS format. {{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format to decimal degree format. {{#invoke:Coordinates | link }} : Export the link used to reach the tools ]] require('strict') local math_mod = require("Module:Math") local coordinates = {}; local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true); local current_page = mw.title.getCurrentTitle() local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' ); local coord_link = 'https://geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '&params=' --[[ Helper function, replacement for {{coord/display/title}} ]] local function displaytitle(coords) return mw.getCurrentFrame():extensionTag{ name = 'indicator', args = { name = 'coordinates' }, content = '<span id="coordinates">[[Geographic coordinate system|Coordinates]]: ' .. coords .. '</span>' } end --[[ Helper function, used in detecting DMS formatting ]] local function dmsTest(first, second) if type(first) ~= 'string' or type(second) ~= 'string' then return nil end local s = (first .. second):upper() return s:find('^[NS][EW]$') or s:find('^[EW][NS]$') end --[[ Wrapper function to grab args, see Module:Arguments for this function's documentation. ]] local function makeInvokeFunc(funcName) return function (frame) local args = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:Coord' }) return coordinates[funcName](args, frame) end end --[[ Helper function, handle optional args. ]] local function optionalArg(arg, supplement) return arg and arg .. supplement or '' end --[[ Formats any error messages generated for display ]] local function errorPrinter(errors) local result = "" for i,v in ipairs(errors) do result = result .. '<strong class="error">Coordinates: ' .. v[2] .. '</strong><br />' end return result end --[[ Determine the required CSS class to display coordinates Usually geo-nondefault is hidden by CSS, unless a user has overridden this for himself default is the mode as specificied by the user when calling the {{coord}} template mode is the display mode (dec or dms) that we will need to determine the css class for ]] local function displayDefault(default, mode) if default == "" then default = "dec" end if default == mode then return "geo-default" else return "geo-nondefault" end end --[[ specPrinter Output formatter. Takes the structure generated by either parseDec or parseDMS and formats it for inclusion on Wikipedia. ]] local function specPrinter(args, coordinateSpec) local uriComponents = coordinateSpec["param"] if uriComponents == "" then -- RETURN error, should never be empty or nil return "ERROR param was empty" end if args["name"] then uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"]) end local geodmshtml = '<span class="geo-dms" title="Maps, aerial photos, and other data for this location">' .. '<span class="latitude">' .. coordinateSpec["dms-lat"] .. '</span> ' .. '<span class="longitude">' ..coordinateSpec["dms-long"] .. '</span>' .. '</span>' local lat = tonumber( coordinateSpec["dec-lat"] ) or 0 local geodeclat if lat < 0 then -- FIXME this breaks the pre-existing precision geodeclat = tostring(coordinateSpec["dec-lat"]):sub(2) .. "°S" else geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°N" end local long = tonumber( coordinateSpec["dec-long"] ) or 0 local geodeclong if long < 0 then -- FIXME does not handle unicode minus geodeclong = tostring(coordinateSpec["dec-long"]):sub(2) .. "°W" else geodeclong = (coordinateSpec["dec-long"] or 0) .. "°E" end local geodechtml = '<span class="geo-dec" title="Maps, aerial photos, and other data for this location">' .. geodeclat .. ' ' .. geodeclong .. '</span>' local geonumhtml = '<span class="geo">' .. coordinateSpec["dec-lat"] .. '; ' .. coordinateSpec["dec-long"] .. '</span>' local inner = '<span class="' .. displayDefault(coordinateSpec["default"], "dms" ) .. '">' .. geodmshtml .. '</span>' .. '<span class="geo-multi-punct">&#xfeff; / &#xfeff;</span>' .. '<span class="' .. displayDefault(coordinateSpec["default"], "dec" ) .. '">'; if not args["name"] then inner = inner .. geodechtml .. '<span style="display:none">&#xfeff; / ' .. geonumhtml .. '</span></span>' else inner = inner .. '<span class="vcard">' .. geodechtml .. '<span style="display:none">&#xfeff; / ' .. geonumhtml .. '</span>' .. '<span style="display:none">&#xfeff; (<span class="fn org">' .. args["name"] .. '</span>)</span></span></span>' end local stylesheetLink = 'Module:Coordinates' .. ( isSandbox and '/sandbox' or '' ) .. '/styles.css' return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = stylesheetLink } } .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents .. ' ' .. inner .. ']</span>' end --[[ Helper function, convert decimal to degrees ]] local function convert_dec2dms_d(coordinate) local d = math_mod._round( coordinate, 0 ) .. "°" return d .. "" end --[[ Helper function, convert decimal to degrees and minutes ]] local function convert_dec2dms_dm(coordinate) coordinate = math_mod._round( coordinate * 60, 0 ); local m = coordinate % 60; coordinate = math.floor( (coordinate - m) / 60 ); local d = coordinate % 360 .."°" return d .. string.format( "%02d′", m ) end --[[ Helper function, convert decimal to degrees, minutes, and seconds ]] local function convert_dec2dms_dms(coordinate) coordinate = math_mod._round( coordinate * 60 * 60, 0 ); local s = coordinate % 60 coordinate = math.floor( (coordinate - s) / 60 ); local m = coordinate % 60 coordinate = math.floor( (coordinate - m) / 60 ); local d = coordinate % 360 .."°" return d .. string.format( "%02d′", m ) .. string.format( "%02d″", s ) end --[[ Helper function, convert decimal latitude or longitude to degrees, minutes, and seconds format based on the specified precision. ]] local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision) local coord = tonumber(coordinate) local postfix if coord >= 0 then postfix = firstPostfix else postfix = secondPostfix end precision = precision:lower(); if precision == "dms" then return convert_dec2dms_dms( math.abs( coord ) ) .. postfix; elseif precision == "dm" then return convert_dec2dms_dm( math.abs( coord ) ) .. postfix; elseif precision == "d" then return convert_dec2dms_d( math.abs( coord ) ) .. postfix; end end --[[ Convert DMS format into a N or E decimal coordinate ]] local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str) local degrees = tonumber(degrees_str) local minutes = tonumber(minutes_str) or 0 local seconds = tonumber(seconds_str) or 0 local factor = 1 if direction == "S" or direction == "W" then factor = -1 end local precision = 0 if seconds_str then precision = 5 + math.max( math_mod._precision(seconds_str), 0 ); elseif minutes_str and minutes_str ~= '' then precision = 3 + math.max( math_mod._precision(minutes_str), 0 ); else precision = math.max( math_mod._precision(degrees_str), 0 ); end local decimal = factor * (degrees+(minutes+seconds/60)/60) return string.format( "%." .. precision .. "f", decimal ) -- not tonumber since this whole thing is string based. end --[[ Checks input values to for out of range errors. ]] local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong ) local errors = {}; lat_d = tonumber( lat_d ) or 0; lat_m = tonumber( lat_m ) or 0; lat_s = tonumber( lat_s ) or 0; long_d = tonumber( long_d ) or 0; long_m = tonumber( long_m ) or 0; long_s = tonumber( long_s ) or 0; if strong then if lat_d < 0 then table.insert(errors, {source, "latitude degrees < 0 with hemisphere flag"}) end if long_d < 0 then table.insert(errors, {source, "longitude degrees < 0 with hemisphere flag"}) end --[[ #coordinates is inconsistent about whether this is an error. If globe: is specified, it won't error on this condition, but otherwise it will. For not simply disable this check. if long_d > 180 then table.insert(errors, {source, "longitude degrees > 180 with hemisphere flag"}) end ]] end if lat_d > 90 then table.insert(errors, {source, "latitude degrees > 90"}) end if lat_d < -90 then table.insert(errors, {source, "latitude degrees < -90"}) end if lat_m >= 60 then table.insert(errors, {source, "latitude minutes >= 60"}) end if lat_m < 0 then table.insert(errors, {source, "latitude minutes < 0"}) end if lat_s >= 60 then table.insert(errors, {source, "latitude seconds >= 60"}) end if lat_s < 0 then table.insert(errors, {source, "latitude seconds < 0"}) end if long_d >= 360 then table.insert(errors, {source, "longitude degrees >= 360"}) end if long_d <= -360 then table.insert(errors, {source, "longitude degrees <= -360"}) end if long_m >= 60 then table.insert(errors, {source, "longitude minutes >= 60"}) end if long_m < 0 then table.insert(errors, {source, "longitude minutes < 0"}) end if long_s >= 60 then table.insert(errors, {source, "longitude seconds >= 60"}) end if long_s < 0 then table.insert(errors, {source, "longitude seconds < 0"}) end return errors; end --[[ parseDec Transforms decimal format latitude and longitude into the structure to be used in displaying coordinates ]] local function parseDec( lat, long, format ) local coordinateSpec = {} local errors = {} if not long then return nil, {{"parseDec", "Missing longitude"}} elseif not tonumber(long) then return nil, {{"parseDec", "Longitude could not be parsed as a number: " .. long}} end errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false ); coordinateSpec["dec-lat"] = lat; coordinateSpec["dec-long"] = long; local mode = coordinates.determineMode( lat, long ); coordinateSpec["dms-lat"] = convert_dec2dms( lat, "N", "S", mode) -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}} coordinateSpec["dms-long"] = convert_dec2dms( long, "E", "W", mode) -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}} if format then coordinateSpec.default = format else coordinateSpec.default = "dec" end return coordinateSpec, errors end --[[ parseDMS Transforms degrees, minutes, seconds format latitude and longitude into the a structure to be used in displaying coordinates ]] local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format ) local coordinateSpec, errors, backward = {}, {} lat_f = lat_f:upper(); long_f = long_f:upper(); -- Check if specified backward if lat_f == 'E' or lat_f == 'W' then lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true; end errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true ); if not long_d then return nil, {{"parseDMS", "Missing longitude" }} elseif not tonumber(long_d) then return nil, {{"parseDMS", "Longitude could not be parsed as a number:" .. long_d }} end if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then if math_mod._precision( lat_d ) > 0 or math_mod._precision( long_d ) > 0 then if lat_f:upper() == 'S' then lat_d = '-' .. lat_d; end if long_f:upper() == 'W' then long_d = '-' .. long_d; end return parseDec( lat_d, long_d, format ); end end coordinateSpec["dms-lat"] = lat_d.."°"..optionalArg(lat_m,"′") .. optionalArg(lat_s,"″") .. lat_f coordinateSpec["dms-long"] = long_d.."°"..optionalArg(long_m,"′") .. optionalArg(long_s,"″") .. long_f coordinateSpec["dec-lat"] = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}} coordinateSpec["dec-long"] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}} if format then coordinateSpec.default = format else coordinateSpec.default = "dms" end return coordinateSpec, errors, backward end --[[ Check the input arguments for coord to determine the kind of data being provided and then make the necessary processing. ]] local function formatTest(args) local result, errors local backward, primary = false, false local function getParam(args, lim) local ret = {} for i = 1, lim do ret[i] = args[i] or '' end return table.concat(ret, '_') end if not args[1] then -- no lat logic return errorPrinter( {{"formatTest", "Missing latitude"}} ) elseif not tonumber(args[1]) then -- bad lat logic return errorPrinter( {{"formatTest", "Unable to parse latitude as a number:" .. args[1]}} ) elseif not args[4] and not args[5] and not args[6] then -- dec logic result, errors = parseDec(args[1], args[2], args.format) if not result then return errorPrinter(errors); end -- formatting for geohack: geohack expects D_N_D_E notation or D;D notation -- wikiminiatlas doesn't support D;D notation -- #coordinates parserfunction doesn't support negative decimals with NSWE result.param = table.concat({ math.abs(tonumber(args[1])), ((tonumber(args[1]) or 0) < 0) and 'S' or 'N', math.abs(tonumber(args[2])), ((tonumber(args[2]) or 0) < 0) and 'W' or 'E', args[3] or ''}, '_') elseif dmsTest(args[4], args[8]) then -- dms logic result, errors, backward = parseDMS(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args.format) if args[10] then table.insert(errors, {'formatTest', 'Extra unexpected parameters'}) end if not result then return errorPrinter(errors) end result.param = getParam(args, 9) elseif dmsTest(args[3], args[6]) then -- dm logic result, errors, backward = parseDMS(args[1], args[2], nil, args[3], args[4], args[5], nil, args[6], args['format']) if args[8] then table.insert(errors, {'formatTest', 'Extra unexpected parameters'}) end if not result then return errorPrinter(errors) end result.param = getParam(args, 7) elseif dmsTest(args[2], args[4]) then -- d logic result, errors, backward = parseDMS(args[1], nil, nil, args[2], args[3], nil, nil, args[4], args.format) if args[6] then table.insert(errors, {'formatTest', 'Extra unexpected parameters'}) end if not result then return errorPrinter(errors) end result.param = getParam(args, 5) else -- Error return errorPrinter({{"formatTest", "Unknown argument format"}}) .. '[[Category:Pages with malformed coordinate tags]]' end result.name = args.name local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'} for _, v in ipairs(extra_param) do if args[v] then table.insert(errors, {'formatTest', 'Parameter: "' .. v .. '=" should be "' .. v .. ':"' }) end end local ret = specPrinter(args, result) if #errors > 0 then ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]' end return ret, backward end --[[ Generate Wikidata tracking categories. ]] local function makeWikidataCategories(qid) local ret local qid = qid or mw.wikibase.getEntityIdForCurrentPage() if mw.wikibase and current_page.namespace == 0 then if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype if snaktype == 'value' then -- coordinates exist both here and on Wikidata, and can be compared. ret = 'Coordinates on Wikidata' elseif snaktype == 'somevalue' then ret = 'Coordinates on Wikidata set to unknown value' elseif snaktype == 'novalue' then ret = 'Coordinates on Wikidata set to no value' end else -- We have to either import the coordinates to Wikidata or remove them here. ret = 'Coordinates not on Wikidata' end end if ret then return string.format('[[Category:%s]]', ret) else return '' end end --[[ link Simple function to export the coordinates link for other uses. Usage: {{#invoke:Coordinates | link }} ]] function coordinates.link(frame) return coord_link; end --[[ dec2dms Wrapper to allow templates to call dec2dms directly. Usage: {{#invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix | negative_suffix | precision }} decimal_coordinate is converted to DMS format. If positive, the positive_suffix is appended (typical N or E), if negative, the negative suffix is appended. The specified precision is one of 'D', 'DM', or 'DMS' to specify the level of detail to use. ]] coordinates.dec2dms = makeInvokeFunc('_dec2dms') function coordinates._dec2dms(args) local coordinate = args[1] local firstPostfix = args[2] or '' local secondPostfix = args[3] or '' local precision = args[4] or '' return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision) end --[[ Helper function to determine whether to use D, DM, or DMS format depending on the precision of the decimal input. ]] function coordinates.determineMode( value1, value2 ) local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) ); if precision <= 0 then return 'd' elseif precision <= 2 then return 'dm'; else return 'dms'; end end --[[ dms2dec Wrapper to allow templates to call dms2dec directly. Usage: {{#invoke:Coordinates | dms2dec | direction_flag | degrees | minutes | seconds }} Converts DMS values specified as degrees, minutes, seconds too decimal format. direction_flag is one of N, S, E, W, and determines whether the output is positive (i.e. N and E) or negative (i.e. S and W). ]] coordinates.dms2dec = makeInvokeFunc('_dms2dec') function coordinates._dms2dec(args) local direction = args[1] local degrees = args[2] local minutes = args[3] local seconds = args[4] return convert_dms2dec(direction, degrees, minutes, seconds) end --[[ coord Main entry point for Lua function to replace {{coord}} Usage: {{#invoke:Coordinates | coord }} {{#invoke:Coordinates | coord | lat | long }} {{#invoke:Coordinates | coord | lat | lat_flag | long | long_flag }} ... Refer to {{coord}} documentation page for many additional parameters and configuration options. Note: This function provides the visual display elements of {{coord}}. In order to load coordinates into the database, the {{#coordinates:}} parser function must also be called, this is done automatically in the Lua version of {{coord}}. ]] coordinates.coord = makeInvokeFunc('_coord') function coordinates._coord(args) if not tonumber(args[1]) and not args[2] then args[3] = args[1]; args[1] = nil local entity = mw.wikibase.getEntityObject(args.qid) if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude if precision then precision = -math_mod._round(math.log(precision)/math.log(10),0) args[1] = math_mod._round(args[1],precision) args[2] = math_mod._round(args[2],precision) end end end local contents, backward = formatTest(args) local Notes = args.notes or '' local Display = args.display and args.display:lower() or 'inline' -- it and ti are short for inline,title and title,inline local function isInline(s) -- Finds whether coordinates are displayed inline. return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti' end local function isInTitle(s) -- Finds whether coordinates are displayed in the title. return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti' end local function coord_wrapper(in_args) -- Calls the parser function {{#coordinates:}}. return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or '' end local text = '' if isInline(Display) then text = text .. '<span class="geo-inline">' .. contents .. Notes .. '</span>' end if isInTitle(Display) then -- Add to output since indicator content is invisible to Lua later on if not isInline(Display) then text = text .. '<span class="geo-inline-hidden noexcerpt">' .. contents .. Notes .. '</span>' end text = text .. displaytitle(contents .. Notes) .. makeWikidataCategories(args.qid) end if not args.nosave then local page_title, count = mw.title.getCurrentTitle(), 1 if backward then local tmp = {} while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end tmp.count = count; count = 2*(count-1) while count >= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end for i, v in ipairs(tmp) do args[i] = v end else while count <= 9 do args[count] = (args[count] or ''); count = count+1 end end if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end args.notes, args.format, args.display = nil text = text .. coord_wrapper(args) end return text end --[[ coord2text Extracts a single value from a transclusion of {{Coord}}. IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED. Usage: {{#invoke:Coordinates | coord2text | {{Coord}} | parameter }} Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source ]] function coordinates._coord2text(coord,type) if coord == '' or type == '' or not type then return nil end type = mw.text.trim(type) if type == 'lat' or type == 'long' then local result, negative = mw.text.split((mw.ustring.match(coord,'[%.%d]+°[NS] [%.%d]+°[EW]') or ''), ' ') if type == 'lat' then result, negative = result[1], 'S' else result, negative = result[2], 'W' end result = mw.text.split(result, '°') if result[2] == negative then result[1] = '-'..result[1] end return result[1] else return mw.ustring.match(coord, 'params=.-_' .. type .. ':(.-)[ _]') end end function coordinates.coord2text(frame) return coordinates._coord2text(frame.args[1],frame.args[2]) end --[[ coordinsert Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}. IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED. Usage: {{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }} Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation. ]] function coordinates.coordinsert(frame) -- for the 2nd or later integer parameter (the first is the coord template, as above) for i, v in ipairs(frame.args) do if i ~= 1 then -- if we cannot find in the coord_template the i_th coordinsert parameter e.g. region if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then -- find from the params= up to the first possibly-present underscore -- and append the i_th coordinsert parameter and a space -- IDK why we're adding a space but it does seem somewhat convenient frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ') end end end if frame.args.name then -- if we can't find the vcard class if not mw.ustring.find(frame.args[1], '<span class="vcard">') then -- take something that looks like a coord template and add the vcard span with class and fn org class local namestr = frame.args.name frame.args[1] = mw.ustring.gsub( frame.args[1], '(<span class="geo%-default">)(<span[^<>]*>[^<>]*</span><span[^<>]*>[^<>]*<span[^<>]*>[^<>]*</span></span>)(</span>)', '%1<span class="vcard">%2<span style="display:none">&#xfeff; (<span class="fn org">' .. namestr .. '</span>)</span></span>%3' ) -- then find anything from coordinates parameters to the 'end' and attach the title parameter frame.args[1] = mw.ustring.gsub( frame.args[1], '(&params=[^&"<>%[%] ]*) ', '%1&title=' .. mw.uri.encode(namestr) .. ' ' ) end end -- replace the existing indicator with a new indicator using the modified content frame.args[1] = mw.ustring.gsub( frame.args[1], '(<span class="geo%-inline[^"]*">(.+)</span>)\127[^\127]*UNIQ%-%-indicator%-%x+%-%-?QINU[^\127]*\127', function (inline, coord) return inline .. displaytitle(coord) end ) return frame.args[1] end return coordinates 6162d7e98fcf6faab5809049e0a48bb3e67d88e3 Module:If preview/configuration 828 21 41 2023-12-17T11:48:57Z BaiatArbore 2 Created page with "--[[ We perform the actual check for whether this is a preview here since preprocessing is relatively expensive. ]] local frame = mw.getCurrentFrame() local function is_preview() local revision_id = frame:preprocess('{{REVISIONID}}') -- {{REVISIONID}} is usually the empty string when previewed. -- I don't know why we're checking for nil but hey, maybe someday things -- would have broken return revision_id == nil or revision_id == '' end local function templatestyl..." Scribunto text/plain --[[ We perform the actual check for whether this is a preview here since preprocessing is relatively expensive. ]] local frame = mw.getCurrentFrame() local function is_preview() local revision_id = frame:preprocess('{{REVISIONID}}') -- {{REVISIONID}} is usually the empty string when previewed. -- I don't know why we're checking for nil but hey, maybe someday things -- would have broken return revision_id == nil or revision_id == '' end local function templatestyles() return frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:If preview/styles.css' } } end return { preview = is_preview(), templatestyles = templatestyles(), warning_infrastructure = '%s<div class="preview-warning"><strong>Preview warning:</strong> %s</div>', missing_warning = 'The template has no warning text. Please add a warning.' } 3edc8897c51a61b9e710b2a4d9eb657b3c2f1034 Module:If preview/styles.css 828 22 42 2023-12-17T11:49:17Z BaiatArbore 2 Created page with "/* {{pp|small=yes}} */ .preview-warning { font-style: italic; /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; color: red; } /* The templatestyles element inserts a link element before hatnotes. * TODO: Remove link if/when WMF resolves T200206 */ .preview-warning + link + .preview-warning { margin-top: -0.5em; }" sanitized-css text/css /* {{pp|small=yes}} */ .preview-warning { font-style: italic; /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; color: red; } /* The templatestyles element inserts a link element before hatnotes. * TODO: Remove link if/when WMF resolves T200206 */ .preview-warning + link + .preview-warning { margin-top: -0.5em; } 8b79ffc4853d424a805b084de00030e04bbd573e Module:If preview 828 23 43 2023-12-17T11:51:46Z BaiatArbore 2 Created page with "local p = {} local cfg = mw.loadData('Module:If preview/configuration') --[[ main This function returns either the first argument or second argument passed to this module, depending on whether the page is being previewed. ]] function p.main(frame) if cfg.preview then return frame.args[1] or '' else return frame.args[2] or '' end end --[[ pmain This function returns either the first argument or second argument passed to this module's parent (i.e. template usi..." Scribunto text/plain local p = {} local cfg = mw.loadData('Module:If preview/configuration') --[[ main This function returns either the first argument or second argument passed to this module, depending on whether the page is being previewed. ]] function p.main(frame) if cfg.preview then return frame.args[1] or '' else return frame.args[2] or '' end end --[[ pmain This function returns either the first argument or second argument passed to this module's parent (i.e. template using this module), depending on whether it is being previewed. ]] function p.pmain(frame) return p.main(frame:getParent()) end local function warning_text(warning) return mw.ustring.format( cfg.warning_infrastructure, cfg.templatestyles, warning ) end function p._warning(args) local warning = args[1] and args[1]:match('^%s*(.-)%s*$') or '' if warning == '' then return warning_text(cfg.missing_warning) end if not cfg.preview then return '' end return warning_text(warning) end --[[ warning This function returns a "preview warning", which is the first argument marked up with HTML and some supporting text, depending on whether the page is being previewed. disabled since we'll implement the template version in general ]] --function p.warning(frame) -- return p._warning(frame.args) --end --[[ warning, but for pass-through templates like {{preview warning}} ]] function p.pwarning(frame) return p._warning(frame:getParent().args) end return p 9a92196d0001b8016f2501aedfadcc3adcb974ef Module:Check for unknown parameters 828 24 44 2023-12-17T11:52:02Z BaiatArbore 2 Created page with "-- This module may be used to compare the arguments passed to the parent -- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext..." Scribunto text/plain -- This module may be used to compare the arguments passed to the parent -- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return '' end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end -- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end -- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(tostring(k), regexp) then knownflag = true break end end if not knownflag and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end end -- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, ' if mw.getCurrentFrame():preprocess( "{{REVISIONID}}" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == '' then v = ' ' end -- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end return table.concat(res) end function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end return p 93db6d115d4328d2a5148bb42959105e367b663e Module:Plain text 828 25 45 2023-12-17T11:52:48Z BaiatArbore 2 Created page with "--converts text with wikilinks to plain text, e.g "[[foo|gah]] is [[bar]]" to "gah is bar" --removes anything enclosed in tags that isn't nested, mediawiki strip markers (references etc), files, italic and bold markup require[[strict]] local p = {} function p.main(frame) local text = frame.args[1] local encode = require('Module:yesno')(frame.args.encode) return p._main(text, encode) end function p._main(text, encode) if not text then return end text = mw.text.kill..." Scribunto text/plain --converts text with wikilinks to plain text, e.g "[[foo|gah]] is [[bar]]" to "gah is bar" --removes anything enclosed in tags that isn't nested, mediawiki strip markers (references etc), files, italic and bold markup require[[strict]] local p = {} function p.main(frame) local text = frame.args[1] local encode = require('Module:yesno')(frame.args.encode) return p._main(text, encode) end function p._main(text, encode) if not text then return end text = mw.text.killMarkers(text) :gsub('&nbsp;', ' ') --replace nbsp spaces with regular spaces :gsub('<br ?/?>', ', ') --replace br with commas :gsub('<span.->(.-)</span>', '%1') --remove spans while keeping text inside :gsub('<i.->(.-)</i>', '%1') --remove italics while keeping text inside :gsub('<b.->(.-)</b>', '%1') --remove bold while keeping text inside :gsub('<em.->(.-)</em>', '%1') --remove emphasis while keeping text inside :gsub('<strong.->(.-)</strong>', '%1') --remove strong while keeping text inside :gsub('<sub.->(.-)</sub>', '%1') --remove subscript markup; retain contents :gsub('<sup.->(.-)</sup>', '%1') --remove superscript markup; retain contents :gsub('<u.->(.-)</u>', '%1') --remove underline markup; retain contents :gsub('<.->.-<.->', '') --strip out remaining tags and the text inside :gsub('<.->', '') --remove any other tag markup :gsub('%[%[%s*[Ff][Ii][Ll][Ee]%s*:.-%]%]', '') --strip out files :gsub('%[%[%s*[Ii][Mm][Aa][Gg][Ee]%s*:.-%]%]', '') --strip out use of image: :gsub('%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:.-%]%]', '') --strip out categories :gsub('%[%[[^%]]-|', '') --strip out piped link text :gsub('([^%[])%[[^%[%]][^%]]-%s', '%1') --strip out external link text :gsub('^%[[^%[%]][^%]]-%s', '') --strip out external link text :gsub('[%[%]]', '') --then strip out remaining [ and ] :gsub("'''''", "") --strip out bold italic markup :gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes :gsub('----+', '') --remove ---- lines :gsub("^%s+", "") --strip leading :gsub("%s+$", "") --and trailing spaces :gsub("%s+", " ") --strip redundant spaces if encode then return mw.text.encode(text) else return text end end return p 8d406c43e8cf1dadf34be7d3b395f44ba4c48b75 Module:Settlement short description 828 26 46 2023-12-17T11:53:00Z BaiatArbore 2 Created page with "--generates auto short description for use in infobox settlement local p = {} p.categories = "" local plain = require('Module:Plain text')._main local getArgs = require('Module:Arguments').getArgs local tableTools = require ('Module:TableTools') function p.reverseTable (init) init[1], init[3] = init[3], init[1] return init end function p.assign (args, argname, num) local val local var = {} for i = 0,num do --handle initial "subdivision_foo" without number if i..." Scribunto text/plain --generates auto short description for use in infobox settlement local p = {} p.categories = "" local plain = require('Module:Plain text')._main local getArgs = require('Module:Arguments').getArgs local tableTools = require ('Module:TableTools') function p.reverseTable (init) init[1], init[3] = init[3], init[1] return init end function p.assign (args, argname, num) local val local var = {} for i = 0,num do --handle initial "subdivision_foo" without number if i == 0 then val = "" else val = tostring(i) end var[i+1] = p.validate(plain(args[argname..val])) end return var end --Display short description using {{short description}} function p.shortdesc(text, frame) return frame:expandTemplate{title = 'Short description', args = {text, 'noreplace'}} end function p.category (cattype) local category = string.format('[[Category:Pages using infobox settlement with bad %s]]', cattype) if category then p.categories = p.categories..category end --categorize end --sanity and other checks function p.validate (parameter, cat) if not parameter then return nil end parameter = parameter:gsub('%b()', '') --remove things in brackets as extraneous information :gsub('%s+', ' ') --fix possible extra spaces from previous cleanup :gsub('^%s+', '') --trim spaces from beginning :gsub('%s+$', '') --trim spaces from end if parameter:match("[,;]") or not parameter:match("%a") then --must have some letters, ignore if multiple types/subdivisions if cat then p.category (cat) end return nil end if (parameter == "") then return nil end return parameter end --removes redundancy like "England, United Kingdom" and fixes issues like "Foo in United States" (to "Foo in the United States") --also used in Module:Type in location function p.cleanupLoc (location) if location == "" then return nil end local replacements = { ["England, United Kingdom"] = "England", ["Scotland, United Kingdom"] = "Scotland", ["Wales, United Kingdom"] = "Wales", ["New York City, New York, United States"] = "New York City", ["^United States$"] = "the United States", ["London, United Kingdom"] = "London, England" } for i, v in pairs(replacements) do location = location:gsub(i, v) --series of replacements end return location end function p.main(frame) local categories = "" local subdivision_types = {} local subdivision_names = {} local args = getArgs (frame, {parentOnly = true}) local settlement_type = p.validate(plain(args.settlement_type or args.type), "settlement type") or "Place" local short_description = plain(args.short_description) subdivision_types = p.assign(args, "subdivision_type", 2) subdivision_names = p.assign(args, "subdivision_name", 2) if short_description then if (short_description == 'no') then return else local language = mw.language.getContentLanguage() return p.shortdesc(language:ucfirst(short_description), frame) end end if not(subdivision_names[3] and (string.find(settlement_type, '[nN]eighbo[u]?rhood') or string.find(settlement_type, '[sS]uburb'))) then subdivision_names[3] = nil --display the third subdivision_type only if suburb or neighborhood end --if say "Voivodeship" is found within the subdivision_type, then specially handle --by adding Voivodeship to the end if not already present for x, y in ipairs (subdivision_types) do local special_types = { "Voivodeship" } for i, j in ipairs(special_types) do if subdivision_names[x] and string.find(y, j, 1, true) and not string.find(subdivision_names[x], j, 1, true) then subdivision_names[x] = subdivision_names[x].." "..j end end end for x, y in ipairs (subdivision_names) do if y then if string.find(settlement_type, y, 1, true) then --if the subdivision is found within the settlement type subdivision_names[x] = nil --don't display redundancy p.category ("settlement type") end if y == mw.title.getCurrentTitle().text then --if the title is the same as one of the subdivision_names subdivision_names[x] = nil --don't display redundancy end end end local location = table.concat(tableTools.compressSparseArray(p.reverseTable(subdivision_names)), ', ') location = p.cleanupLoc (location) if location then location = " in " .. location else location = "" end local language = mw.language.getContentLanguage() return p.shortdesc(language:ucfirst(settlement_type..location), frame)..p.categories end return p f2f1adada5fd2b30e158e56b9f05102571b2a17f Module:Check for clobbered parameters 828 27 47 2023-12-17T11:54:38Z BaiatArbore 2 Created page with "local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end function p.check(frame) local args = frame.args local pargs = frame:getParent().args local checknested = isnotempty(args['nested']) local delimiter = isnotempty(args['delimiter']) and args['delimiter'] or ';' local argpairs = {} for k, v in pairs(args) do if type(k) == 'number' then local plist = mw.text.split(v, delimiter)..." Scribunto text/plain local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end function p.check(frame) local args = frame.args local pargs = frame:getParent().args local checknested = isnotempty(args['nested']) local delimiter = isnotempty(args['delimiter']) and args['delimiter'] or ';' local argpairs = {} for k, v in pairs(args) do if type(k) == 'number' then local plist = mw.text.split(v, delimiter) local pfound = {} local count = 0 for ii, vv in ipairs(plist) do vv = trim(vv) if checknested and pargs[vv] or isnotempty(pargs[vv]) then count = count + 1 table.insert(pfound, vv) end end if count > 1 then table.insert(argpairs, pfound) end end end local warnmsg = {} local res = '' local cat = '' if args['cat'] and mw.ustring.match(args['cat'],'^[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]:') then cat = args['cat'] end local template = args['template'] and ' in ' .. args['template'] or '' if #argpairs > 0 then for i, v in ipairs( argpairs ) do table.insert( warnmsg, mw.ustring.format( 'Using more than one of the following parameters%s: <code>%s</code>.', template, table.concat(v, '</code>, <code>') ) ) if cat ~= '' then res = res .. '[[' .. cat .. '|' .. (v[1] == '' and ' ' or '') .. v[1] .. ']]' end end end if #warnmsg > 0 then res = require('Module:If preview')._warning({ table.concat(warnmsg, '<br>') }) .. res end return res end return p 2d18fb6802fa261d88a0e135ab147ab9f062acde Template:Main other 10 28 48 2023-12-17T11:55:36Z BaiatArbore 2 Created page with "{{#switch: <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--> | {{#ifeq:{{NAMESPACE}}|{{ns:0}} | main | other }} }} | main = {{{1|}}} | other | #default = {{{2|}}} }}<noinclude> {{documentation}} <!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! --> </noinclude>" wikitext text/x-wiki {{#switch: <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--> | {{#ifeq:{{NAMESPACE}}|{{ns:0}} | main | other }} }} | main = {{{1|}}} | other | #default = {{{2|}}} }}<noinclude> {{documentation}} <!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! --> </noinclude> 86ad907ffeea3cc545159e00cd1f2d6433946450 Module:String 828 29 49 2023-12-17T11:56:27Z BaiatArbore 2 Created page with "--[[ This module is intended to provide access to basic string functions. Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace. Global options ignore_errors: If set to 'true' or 1, any error c..." Scribunto text/plain --[[ This module is intended to provide access to basic string functions. Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace. Global options ignore_errors: If set to 'true' or 1, any error condition will result in an empty string being returned rather than an error message. error_category: If an error occurs, specifies the name of a category to include with the error message. The default category is [Category:Errors reported by Module String]. no_category: If set to 'true' or 1, no category will be added if an error is generated. Unit tests for this module are available at Module:String/tests. ]] local str = {} --[[ len This function returns the length of the target string. Usage: {{#invoke:String|len|target_string|}} OR {{#invoke:String|len|s=target_string}} Parameters s: The string whose length to report If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. ]] function str.len( frame ) local new_args = str._getParameters( frame.args, {'s'} ) local s = new_args['s'] or '' return mw.ustring.len( s ) end --[[ sub This function returns a substring of the target string at specified indices. Usage: {{#invoke:String|sub|target_string|start_index|end_index}} OR {{#invoke:String|sub|s=target_string|i=start_index|j=end_index}} Parameters s: The string to return a subset of i: The first index of the substring to return, defaults to 1. j: The last index of the string to return, defaults to the last character. The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string. If the requested indices are out of range for the given string, an error is reported. ]] function str.sub( frame ) local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } ) local s = new_args['s'] or '' local i = tonumber( new_args['i'] ) or 1 local j = tonumber( new_args['j'] ) or -1 local len = mw.ustring.len( s ) -- Convert negatives for range checking if i < 0 then i = len + i + 1 end if j < 0 then j = len + j + 1 end if i > len or j > len or i < 1 or j < 1 then return str._error( 'String subset index out of range' ) end if j < i then return str._error( 'String subset indices out of order' ) end return mw.ustring.sub( s, i, j ) end --[[ This function implements that features of {{str sub old}} and is kept in order to maintain these older templates. ]] function str.sublength( frame ) local i = tonumber( frame.args.i ) or 0 local len = tonumber( frame.args.len ) return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) ) end --[[ _match This function returns a substring from the source string that matches a specified pattern. It is exported for use in other modules Usage: strmatch = require("Module:String")._match sresult = strmatch( s, pattern, start, match, plain, nomatch ) Parameters s: The string to search pattern: The pattern or string to find within the string start: The index within the source string to start the search. The first character of the string has index 1. Defaults to 1. match: In some cases it may be possible to make multiple matches on a single string. This specifies which match to return, where the first match is match= 1. If a negative number is specified then a match is returned counting from the last match. Hence match = -1 is the same as requesting the last match. Defaults to 1. plain: A flag indicating that the pattern should be understood as plain text. Defaults to false. nomatch: If no match is found, output the "nomatch" value rather than an error. For information on constructing Lua patterns, a form of [regular expression], see: * http://www.lua.org/manual/5.1/manual.html#5.4.1 * http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns * http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns ]] -- This sub-routine is exported for use in other modules function str._match( s, pattern, start, match_index, plain_flag, nomatch ) if s == '' then return str._error( 'Target string is empty' ) end if pattern == '' then return str._error( 'Pattern string is empty' ) end start = tonumber(start) or 1 if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then return str._error( 'Requested start is out of range' ) end if match_index == 0 then return str._error( 'Match index is out of range' ) end if plain_flag then pattern = str._escapePattern( pattern ) end local result if match_index == 1 then -- Find first match is simple case result = mw.ustring.match( s, pattern, start ) else if start > 1 then s = mw.ustring.sub( s, start ) end local iterator = mw.ustring.gmatch(s, pattern) if match_index > 0 then -- Forward search for w in iterator do match_index = match_index - 1 if match_index == 0 then result = w break end end else -- Reverse search local result_table = {} local count = 1 for w in iterator do result_table[count] = w count = count + 1 end result = result_table[ count + match_index ] end end if result == nil then if nomatch == nil then return str._error( 'Match not found' ) else return nomatch end else return result end end --[[ match This function returns a substring from the source string that matches a specified pattern. Usage: {{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}} OR {{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index |match=match_number|plain=plain_flag|nomatch=nomatch_output}} Parameters s: The string to search pattern: The pattern or string to find within the string start: The index within the source string to start the search. The first character of the string has index 1. Defaults to 1. match: In some cases it may be possible to make multiple matches on a single string. This specifies which match to return, where the first match is match= 1. If a negative number is specified then a match is returned counting from the last match. Hence match = -1 is the same as requesting the last match. Defaults to 1. plain: A flag indicating that the pattern should be understood as plain text. Defaults to false. nomatch: If no match is found, output the "nomatch" value rather than an error. If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from each string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace. If the match_number or start_index are out of range for the string being queried, then this function generates an error. An error is also generated if no match is found. If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure. For information on constructing Lua patterns, a form of [regular expression], see: * http://www.lua.org/manual/5.1/manual.html#5.4.1 * http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns * http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns ]] -- This is the entry point for #invoke:String|match function str.match( frame ) local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} ) local s = new_args['s'] or '' local start = tonumber( new_args['start'] ) or 1 local plain_flag = str._getBoolean( new_args['plain'] or false ) local pattern = new_args['pattern'] or '' local match_index = math.floor( tonumber(new_args['match']) or 1 ) local nomatch = new_args['nomatch'] return str._match( s, pattern, start, match_index, plain_flag, nomatch ) end --[[ pos This function returns a single character from the target string at position pos. Usage: {{#invoke:String|pos|target_string|index_value}} OR {{#invoke:String|pos|target=target_string|pos=index_value}} Parameters target: The string to search pos: The index for the character to return If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace. The first character has an index value of 1. If one requests a negative value, this function will select a character by counting backwards from the end of the string. In other words pos = -1 is the same as asking for the last character. A requested value of zero, or a value greater than the length of the string returns an error. ]] function str.pos( frame ) local new_args = str._getParameters( frame.args, {'target', 'pos'} ) local target_str = new_args['target'] or '' local pos = tonumber( new_args['pos'] ) or 0 if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then return str._error( 'String index out of range' ) end return mw.ustring.sub( target_str, pos, pos ) end --[[ str_find This function duplicates the behavior of {{str_find}}, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead. Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source". Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separatetly. ]] function str.str_find( frame ) local new_args = str._getParameters( frame.args, {'source', 'target'} ) local source_str = new_args['source'] or '' local target_str = new_args['target'] or '' if target_str == '' then return 1 end local start = mw.ustring.find( source_str, target_str, 1, true ) if start == nil then start = -1 end return start end --[[ find This function allows one to search for a target string or pattern within another string. Usage: {{#invoke:String|find|source_str|target_string|start_index|plain_flag}} OR {{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}} Parameters source: The string to search target: The string or pattern to find within source start: The index within the source string to start the search, defaults to 1 plain: Boolean flag indicating that target should be understood as plain text and not as a Lua style regular expression, defaults to true If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. In some circumstances this is desirable, in other cases one may want to preserve the whitespace. This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0. This function should be safe for UTF-8 strings. ]] function str.find( frame ) local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } ) local source_str = new_args['source'] or '' local pattern = new_args['target'] or '' local start_pos = tonumber(new_args['start']) or 1 local plain = new_args['plain'] or true if source_str == '' or pattern == '' then return 0 end plain = str._getBoolean( plain ) local start = mw.ustring.find( source_str, pattern, start_pos, plain ) if start == nil then start = 0 end return start end --[[ replace This function allows one to replace a target string or pattern within another string. Usage: {{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}} OR {{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string| count=replacement_count|plain=plain_flag}} Parameters source: The string to search pattern: The string or pattern to find within source replace: The replacement text count: The number of occurences to replace, defaults to all. plain: Boolean flag indicating that pattern should be understood as plain text and not as a Lua style regular expression, defaults to true ]] function str.replace( frame ) local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } ) local source_str = new_args['source'] or '' local pattern = new_args['pattern'] or '' local replace = new_args['replace'] or '' local count = tonumber( new_args['count'] ) local plain = new_args['plain'] or true if source_str == '' or pattern == '' then return source_str end plain = str._getBoolean( plain ) if plain then pattern = str._escapePattern( pattern ) replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences. end local result if count ~= nil then result = mw.ustring.gsub( source_str, pattern, replace, count ) else result = mw.ustring.gsub( source_str, pattern, replace ) end return result end --[[ simple function to pipe string.rep to templates. ]] function str.rep( frame ) local repetitions = tonumber( frame.args[2] ) if not repetitions then return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' ) end return string.rep( frame.args[1] or '', repetitions ) end --[[ escapePattern This function escapes special characters from a Lua string pattern. See [1] for details on how patterns work. [1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns Usage: {{#invoke:String|escapePattern|pattern_string}} Parameters pattern_string: The pattern string to escape. ]] function str.escapePattern( frame ) local pattern_str = frame.args[1] if not pattern_str then return str._error( 'No pattern string specified' ) end local result = str._escapePattern( pattern_str ) return result end --[[ count This function counts the number of occurrences of one string in another. ]] function str.count(frame) local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'}) local source = args.source or '' local pattern = args.pattern or '' local plain = str._getBoolean(args.plain or true) if plain then pattern = str._escapePattern(pattern) end local _, count = mw.ustring.gsub(source, pattern, '') return count end --[[ endswith This function determines whether a string ends with another string. ]] function str.endswith(frame) local args = str._getParameters(frame.args, {'source', 'pattern'}) local source = args.source or '' local pattern = args.pattern or '' if pattern == '' then -- All strings end with the empty string. return "yes" end if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then return "yes" else return "" end end --[[ join Join all non empty arguments together; the first argument is the separator. Usage: {{#invoke:String|join|sep|one|two|three}} ]] function str.join(frame) local args = {} local sep for _, v in ipairs( frame.args ) do if sep then if v ~= '' then table.insert(args, v) end else sep = v end end return table.concat( args, sep or '' ) end --[[ Helper function that populates the argument list given that user may need to use a mix of named and unnamed parameters. This is relevant because named parameters are not identical to unnamed parameters due to string trimming, and when dealing with strings we sometimes want to either preserve or remove that whitespace depending on the application. ]] function str._getParameters( frame_args, arg_list ) local new_args = {} local index = 1 local value for _, arg in ipairs( arg_list ) do value = frame_args[arg] if value == nil then value = frame_args[index] index = index + 1 end new_args[arg] = value end return new_args end --[[ Helper function to handle error messages. ]] function str._error( error_str ) local frame = mw.getCurrentFrame() local error_category = frame.args.error_category or 'Errors reported by Module String' local ignore_errors = frame.args.ignore_errors or false local no_category = frame.args.no_category or false if str._getBoolean(ignore_errors) then return '' end local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>' if error_category ~= '' and not str._getBoolean( no_category ) then error_str = '[[Category:' .. error_category .. ']]' .. error_str end return error_str end --[[ Helper Function to interpret boolean strings ]] function str._getBoolean( boolean_str ) local boolean_value if type( boolean_str ) == 'string' then boolean_str = boolean_str:lower() if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0' or boolean_str == '' then boolean_value = false else boolean_value = true end elseif type( boolean_str ) == 'boolean' then boolean_value = boolean_str else error( 'No boolean value found' ) end return boolean_value end --[[ Helper function that escapes all pattern characters so that they will be treated as plain text. ]] function str._escapePattern( pattern_str ) return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" ) end return str 2ad0905c56ef4955950b75a8f00974fe82aed5e4 Template:Short description 10 30 50 2023-12-17T11:56:48Z BaiatArbore 2 Created page with "{{#ifeq:{{lc:{{{1|}}}}}|none|<nowiki /><!--Prevents whitespace issues when used with adjacent newlines-->|<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">{{{1|}}}{{SHORTDESC:{{{1|}}}|{{{2|}}}}}</div>}}<includeonly>{{#ifeq:{{{pagetype}}}|Disambiguation pages||{{#ifeq:{{pagetype |defaultns = all |user=exclude}}|exclude||{{#ifeq:{{#switch: {{NAMESPACENUMBER}} | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 100 | 101 | 118 | 11..." wikitext text/x-wiki {{#ifeq:{{lc:{{{1|}}}}}|none|<nowiki /><!--Prevents whitespace issues when used with adjacent newlines-->|<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">{{{1|}}}{{SHORTDESC:{{{1|}}}|{{{2|}}}}}</div>}}<includeonly>{{#ifeq:{{{pagetype}}}|Disambiguation pages||{{#ifeq:{{pagetype |defaultns = all |user=exclude}}|exclude||{{#ifeq:{{#switch: {{NAMESPACENUMBER}} | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 100 | 101 | 118 | 119 | 828 | 829 | = exclude|#default=}}|exclude||[[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with short description]]}}}}}}</includeonly><!-- Start tracking -->{{#invoke:Check for unknown parameters|check|unknown={{Main other|[[Category:Pages using short description with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Short description]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | pagetype | bot |plural }}<!-- -->{{#ifexpr: {{#invoke:String|len|{{{1|}}}}}>100 | [[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with long short description]]}}<!-- --><includeonly>{{#if:{{{1|}}}||[[Category:Pages with empty short description]]}}</includeonly><!-- -->{{Short description/lowercasecheck|{{{1|}}}}}<!-- -->{{Main other |{{SDcat |sd={{{1|}}} }} }}<noinclude> {{Documentation}} </noinclude> f175a6d61b40a87adb43e2dd4f73c7979759b34c Template:Short description/lowercasecheck 10 31 51 2023-12-17T11:57:14Z BaiatArbore 2 Created page with "{{#ifeq:<!--test first character for lower-case letter-->{{#invoke:string|find|1={{{1|}}}|2=^%l|plain=false}}|1 |<!-- first character is a lower case letter; test against whitelist -->{{#switch: {{First word|{{{1|}}}}}<!--begin whitelist--> |c. <!--for circa--> |gTLD |iMac |iOS |iOS, |iPad |iPhone |iTunes |macOS |none |pH |pH-dependent=<!-- end whitelist; short description starts with an allowed lower-case string; whitelist matched; do nothing --> |#default=<!-- apply c..." wikitext text/x-wiki {{#ifeq:<!--test first character for lower-case letter-->{{#invoke:string|find|1={{{1|}}}|2=^%l|plain=false}}|1 |<!-- first character is a lower case letter; test against whitelist -->{{#switch: {{First word|{{{1|}}}}}<!--begin whitelist--> |c. <!--for circa--> |gTLD |iMac |iOS |iOS, |iPad |iPhone |iTunes |macOS |none |pH |pH-dependent=<!-- end whitelist; short description starts with an allowed lower-case string; whitelist matched; do nothing --> |#default=<!-- apply category to track lower-case short descriptions -->{{main other|[[Category:Pages with lower-case short description|{{trim|{{{1|}}}}}]]}}{{Testcases other|{{red|CATEGORY APPLIED}}}}<!-- end whitelist test -->}} |<!-- short description does not start with lower-case letter; do nothing; end lower-case test --> }}<noinclude> {{documentation}} </noinclude> 9a6d4db14b74614625fd234b4f8ee3c8e1a235c0 Template:Infobox 10 32 52 2023-12-17T11:57:56Z BaiatArbore 2 Created page with "{{#invoke:Infobox|infobox}}<includeonly>{{template other|{{#ifeq:{{PAGENAME}}|Infobox||{{#ifeq:{{str left|{{SUBPAGENAME}}|7}}|Infobox|[[Category:Infobox templates|{{remove first word|{{SUBPAGENAME}}}}]]}}}}|}}</includeonly><noinclude> {{documentation}} <!-- Categories go in the /doc subpage, and interwikis go in Wikidata. --> </noinclude>" wikitext text/x-wiki {{#invoke:Infobox|infobox}}<includeonly>{{template other|{{#ifeq:{{PAGENAME}}|Infobox||{{#ifeq:{{str left|{{SUBPAGENAME}}|7}}|Infobox|[[Category:Infobox templates|{{remove first word|{{SUBPAGENAME}}}}]]}}}}|}}</includeonly><noinclude> {{documentation}} <!-- Categories go in the /doc subpage, and interwikis go in Wikidata. --> </noinclude> 817a9f5b6524eced06a57bd1d5fd7179f9369bf2 Template:Infobox settlement/styles.css 10 6 53 25 2023-12-17T11:59:06Z BaiatArbore 2 BaiatArbore changed the content model of the page [[Template:Infobox settlement/styles.css]] from "CSS" to "Sanitized CSS": Did not work with regular css sanitized-css text/css /* {{pp|small=y}} */ .ib-settlement { width: 23em; border-collapse: collapse; line-height: 1.2em; } /* TODO split definitions to appropriate class names when live from HTML element */ .ib-settlement td, .ib-settlement th { border-top: 1px solid #a2a9b1; padding: 0.4em 0.6em 0.4em 0.6em; } .ib-settlement .mergedtoprow .infobox-full-data, .ib-settlement .mergedtoprow .infobox-header, .ib-settlement .mergedtoprow .infobox-data, .ib-settlement .mergedtoprow .infobox-label, .ib-settlement .mergedtoprow .infobox-below { border-top: 1px solid #a2a9b1; padding: 0.4em 0.6em 0.2em 0.6em; } .ib-settlement .mergedrow .infobox-full-data, .ib-settlement .mergedrow .infobox-data, .ib-settlement .mergedrow .infobox-label { border: 0; padding: 0 0.6em 0.2em 0.6em; } .ib-settlement .mergedbottomrow .infobox-full-data, .ib-settlement .mergedbottomrow .infobox-data, .ib-settlement .mergedbottomrow .infobox-label { border-top: 0; border-bottom: 1px solid #a2a9b1; padding: 0 0.6em 0.4em 0.6em; } .ib-settlement .maptable { border: 0; padding: 0; } .ib-settlement .infobox-header, .ib-settlement .infobox-below { text-align: left; } .ib-settlement .infobox-above { font-size: 125%; line-height: 1.3em; } .ib-settlement .infobox-subheader { background-color: #cddeff; font-weight: bold; } .ib-settlement-native { font-weight: normal; padding-top: 0.2em; } .ib-settlement-other-name { font-size: 78%; } .ib-settlement-official { font-weight: bold; } .ib-settlement-caption { padding: 0.3em 0 0 0; } .ib-settlement-caption-link { padding: 0.2em 0; } .ib-settlement-nickname { display: inline; } .ib-settlement-fn { font-weight: normal; display: inline; } bcad428737f5a62eb7bced25a38fccbd46dde186 Module:If empty 828 33 54 2023-12-17T12:00:17Z BaiatArbore 2 Created page with "local p = {} function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false}) for k,v in ipairs(args) do if v ~= '' then return v end end end return p" Scribunto text/plain local p = {} function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false}) for k,v in ipairs(args) do if v ~= '' then return v end end end return p 4790391408957dea3ff9f453834c05f6b379a45c Template:If empty 10 34 55 2023-12-17T12:00:41Z BaiatArbore 2 Created page with "{{<includeonly>safesubst:</includeonly>#invoke:If empty|main}}<noinclude>{{Documentation}}</noinclude>" wikitext text/x-wiki {{<includeonly>safesubst:</includeonly>#invoke:If empty|main}}<noinclude>{{Documentation}}</noinclude> 745940b7bdde8a1585c887ee4ee5ce81d98461a4 Template:Infobox settlement/columns 10 35 56 2023-12-17T12:02:05Z BaiatArbore 2 Created page with "<templatestyles src="Infobox settlement/columns/styles.css"/> <div class="ib-settlement-cols"> <div class="ib-settlement-cols-row">{{#if:{{{0|}}} |<!-- if 0 -->{{#if:{{{1|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}} |<!-- if 0 and (1 or 2 or 3 or 4 or 5) --><div class="ib-settlement-cols-cellt"> {{#if:{{{1|}}}|<div>{{{1}}}</div>}} {{#if:{{{2|}}}|<div>{{{2}}}</div>}} {{#if:{{{3|}}}|<div>{{{3}}}</div>}} {{#if:{{{4|}}}|<div>{{{4}}}</div>}} {{#if:{{{5|}}}|<div>{{{5}}}</div>}} </di..." wikitext text/x-wiki <templatestyles src="Infobox settlement/columns/styles.css"/> <div class="ib-settlement-cols"> <div class="ib-settlement-cols-row">{{#if:{{{0|}}} |<!-- if 0 -->{{#if:{{{1|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}} |<!-- if 0 and (1 or 2 or 3 or 4 or 5) --><div class="ib-settlement-cols-cellt"> {{#if:{{{1|}}}|<div>{{{1}}}</div>}} {{#if:{{{2|}}}|<div>{{{2}}}</div>}} {{#if:{{{3|}}}|<div>{{{3}}}</div>}} {{#if:{{{4|}}}|<div>{{{4}}}</div>}} {{#if:{{{5|}}}|<div>{{{5}}}</div>}} </div> }}<div class="ib-settlement-cols-cellt">{{{0}}}</div> |<!-- if not 0 -->{{#ifexpr:({{#if:{{{1|}}}|1|0}}+{{#if:{{{2|}}}|1|0}}+{{#if:{{{3|}}}|1|0}}+{{#if:{{{4|}}}|1|0}}) > 2 |<!-- if more than two images -->{{#if:{{{1|}}} |<div class="ib-settlement-cols-cell">{{{1}}}</div>{{#if:{{{2|}}}||</div></div><div class="ib-settlement-cols"><!-- TODO: The "3" element case currently produces two div-tables, which is non-optimal, but someone else should figure out how to fix it; 4 and 2 cases output as one "table". --><div class="ib-settlement-cols-row">}} }}{{#if:{{{2|}}} |<div class="ib-settlement-cols-cell">{{{2}}}</div>{{#if:{{{1|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}} }}</div><div class="ib-settlement-cols-row">{{#if:{{{3|}}} |{{#if:{{{4|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{3}}}</div> }}{{#if:{{{4|}}} |{{#if:{{{3|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{4}}}</div> }} |<!-- if two or fewer images -->{{#if:{{{1|}}}|<div class="ib-settlement-cols-cell">{{{1}}}</div>}}<!-- -->{{#if:{{{2|}}}|<div class="ib-settlement-cols-cell">{{{2}}}</div>}}<!-- -->{{#if:{{{3|}}}|<div class="ib-settlement-cols-cell">{{{3}}}</div>}}<!-- -->{{#if:{{{4|}}}|<div class="ib-settlement-cols-cell">{{{4}}}</div>}} }} }}</div></div><noinclude> {{documentation}} </noinclude> bdd926fcf77e5f0f9f899ac6b2e23cd7efc8584e Template:Infobox settlement/columns/styles.css 10 36 57 2023-12-17T12:02:32Z BaiatArbore 2 Created page with "/* {{pp|small=y}} */ .ib-settlement-cols { text-align: center; display: table; width: 100%; } .ib-settlement-cols-row { display: table-row; } .ib-settlement-cols-cell { display: table-cell; vertical-align: middle; } .ib-settlement-cols-cellt { display: table-cell; vertical-align: top; }" sanitized-css text/css /* {{pp|small=y}} */ .ib-settlement-cols { text-align: center; display: table; width: 100%; } .ib-settlement-cols-row { display: table-row; } .ib-settlement-cols-cell { display: table-cell; vertical-align: middle; } .ib-settlement-cols-cellt { display: table-cell; vertical-align: top; } 7dbb426d519700a7c47317b5c131244df8fc62f0 London 0 37 58 2023-12-17T12:04:32Z BaiatArbore 2 broken infobox wikitext text/x-wiki {{Infobox settlement|name=London|settlement_type=Capital city}} 09eae434316bf73c86fb7d7abec73aeab20eaf9f 66 58 2023-12-17T17:02:38Z BaiatArbore 2 wikitext text/x-wiki {{Infobox settlement |name=London |settlement_type=Capital city |coordinates={{coord|51|30|26|N|0|7|39|W|region:GB-ENG|display=inline,title}} }} 9a649433c3aa1c972c1ba8d9ce2fc68a062f1db9 68 66 2023-12-17T17:05:08Z BaiatArbore 2 wikitext text/x-wiki {{Infobox settlement |name=London |settlement_type=Capital city |pushpin_map= UK#England#Europe#Earth |coordinates={{coord|51|30|26|N|0|7|39|W|region:GB-ENG|display=inline,title}} }} 4dc26d641268cff479b18af3dbc5727e820a8e6e 69 68 2023-12-17T17:05:30Z BaiatArbore 2 wikitext text/x-wiki {{Infobox settlement |name=London |settlement_type=Capital city |coordinates={{coord|51|30|26|N|0|7|39|W|region:GB-ENG|display=inline,title}} }} 9a649433c3aa1c972c1ba8d9ce2fc68a062f1db9 89 69 2023-12-17T17:35:05Z BaiatArbore 2 wikitext text/x-wiki {{Infobox settlement |name=London |settlement_type=Capital city |coordinates={{coord|51|30|26|N|0|7|39|W|region:GB-ENG|display=inline,title}} |image_skyline=LondonSkyline.png|image_caption=Skyline of London|subdivision_name=[[United Kingdom]]|subdivision_name1=[[England]]|subdivision_name2=[[Greater London|London (Greater London)]]|subdivision_name3=[[Greater London|Greater London (ceremonial county)]]<br />[[City of London]]|subdivision_type3=[[Ceremonial counties of England|Ceremonial counties]]|subdivision_type2=[[Regions of England|Region]]|subdivision_type1=[[Countries of the United Kingdom|Country]]|subdivision_type=[[List of countries|Country]]|subdivision_type4=[[Districts of England|Local government districts]]|subdivision_name4=[[London boroughs|32 London boroughs]],<br />and the City of London}} 74b550edf8591dce16d3b66da2190b27d9c040ef 90 89 2023-12-17T17:36:53Z BaiatArbore 2 wikitext text/x-wiki {{Infobox settlement |name=London |settlement_type=Capital city |coordinates={{coord|51|30|26|N|0|7|39|W|region:GB-ENG|display=inline,title}} |image_skyline=LondonSkyline.png |image_caption=Skyline of London |subdivision_name=[[United Kingdom]] |subdivision_name1=[[England]] |subdivision_name2=[[Greater London|London (Greater London)]] |subdivision_name3=[[Greater London|Greater London (ceremonial county)]]<br />[[City of London]] |subdivision_type3=[[Ceremonial counties of England|Ceremonial counties]] |subdivision_type2=[[Regions of England|Region]] |subdivision_type1=[[Countries of the United Kingdom|Country]] |subdivision_type=[[List of countries|Country]] |subdivision_type4=[[Districts of England|Local government districts]] |subdivision_name4=[[London boroughs|32 London boroughs]],<br />and the City of London}} 648ddf48af8309ef766f06b558322e9d46b3c4fe 91 90 2023-12-17T17:37:39Z BaiatArbore 2 wikitext text/x-wiki {{Infobox settlement |name=London |settlement_type=Capital city |coordinates={{coord|51|30|26|N|0|7|39|W|region:GB-ENG|display=inline,title}} |image_skyline=LondonSkyline.png |image_caption=Skyline of London | pushpin_map = UK#England#Europe#Earth |subdivision_name=[[United Kingdom]] |subdivision_name1=[[England]] |subdivision_name2=[[Greater London|London (Greater London)]] |subdivision_name3=[[Greater London|Greater London (ceremonial county)]]<br />[[City of London]] |subdivision_type3=[[Ceremonial counties of England|Ceremonial counties]] |subdivision_type2=[[Regions of England|Region]] |subdivision_type1=[[Countries of the United Kingdom|Country]] |subdivision_type=[[List of countries|Country]] |subdivision_type4=[[Districts of England|Local government districts]] |subdivision_name4=[[London boroughs|32 London boroughs]],<br />and the City of London}} 8b0e41a3a54929d177875368011dae4fc2f82426 97 91 2023-12-17T17:44:34Z BaiatArbore 2 wikitext text/x-wiki {{Infobox settlement |name=London |settlement_type=Capital city |coordinates={{coord|51|30|26|N|0|7|39|W|region:GB-ENG|display=inline,title}} |image_skyline=LondonSkyline.png |image_caption=Skyline of London | pushpin_map = UK#England#Europe#Earth | pushpin_map_caption = Location within the United Kingdom##Location within England##Location within Europe | pushpin_relief = 1 |subdivision_name=[[United Kingdom]] |subdivision_name1=[[England]] |subdivision_name2=[[Greater London|London (Greater London)]] |subdivision_name3=[[Greater London|Greater London (ceremonial county)]]<br />[[City of London]] |subdivision_type3=[[Ceremonial counties of England|Ceremonial counties]] |subdivision_type2=[[Regions of England|Region]] |subdivision_type1=[[Countries of the United Kingdom|Country]] |subdivision_type=[[List of countries|Country]] |subdivision_type4=[[Districts of England|Local government districts]] |subdivision_name4=[[London boroughs|32 London boroughs]],<br />and the City of London}} ca3affeb582298ee89e724f6f90f2de8aa2b1600 98 97 2023-12-17T19:31:45Z BaiatArbore 2 wikitext text/x-wiki {{Infobox settlement |name=London |settlement_type=Capital city |coordinates={{coord|51|30|26|N|0|7|39|W|region:GB-ENG|display=inline,title}} |image_skyline=LondonSkyline.png |image_caption=Skyline of London | pushpin_map = UK#England#Europe#Earth | pushpin_map_caption = Location within the United Kingdom##Location within England##Location within Europe | pushpin_relief = 1 |subdivision_name=[[United Kingdom]] |subdivision_name1=[[England]] |subdivision_name2=[[Greater London|London (Greater London)]] |subdivision_name3=[[Greater London|Greater London (ceremonial county)]]<br />[[City of London]] |subdivision_type3=[[Ceremonial counties of England|Ceremonial counties]] |subdivision_type2=[[Regions of England|Region]] |subdivision_type1=[[Countries of the United Kingdom|Country]] |subdivision_type=[[List of countries|Country]] |subdivision_type4=[[Districts of England|Local government districts]] |subdivision_name4=[[London boroughs|32 London boroughs]],<br />and the City of London|population_metro=14,800,000|population_metro_footnotes=&nbsp;(2023)<ref name="CityPopulation.de show">{{Cite web |url=https://www.citypopulation.de/en/world/agglomerations/|title=Major agglomerations of the world|website=CityPopulation.de|access-date=20 April 2023}}</ref>}} 4f4e26f27767509d065026d513d8c8b674414842 Module:Location map 828 38 59 2023-12-17T12:06:19Z BaiatArbore 2 Created page with "require('strict') local p = {} local getArgs = require('Module:Arguments').getArgs local function round(n, decimals) local pow = 10^(decimals or 0) return math.floor(n * pow + 0.5) / pow end function p.getMapParams(map, frame) if not map then error('The name of the location map definition to use must be specified', 2) end local moduletitle = mw.title.new('Module:Location map/data/' .. map) if not moduletitle then error(string.format('%q is not a valid name..." Scribunto text/plain require('strict') local p = {} local getArgs = require('Module:Arguments').getArgs local function round(n, decimals) local pow = 10^(decimals or 0) return math.floor(n * pow + 0.5) / pow end function p.getMapParams(map, frame) if not map then error('The name of the location map definition to use must be specified', 2) end local moduletitle = mw.title.new('Module:Location map/data/' .. map) if not moduletitle then error(string.format('%q is not a valid name for a location map definition', map), 2) elseif moduletitle.exists then local mapData = mw.loadData('Module:Location map/data/' .. map) return function(name, params) if name == nil then return 'Module:Location map/data/' .. map elseif mapData[name] == nil then return '' elseif params then return mw.message.newRawMessage(tostring(mapData[name]), unpack(params)):plain() else return mapData[name] end end else error('Unable to find the specified location map definition: "Module:Location map/data/' .. map .. '" does not exist', 2) end end function p.data(frame, args, map) if not args then args = getArgs(frame, {frameOnly = true}) end if not map then map = p.getMapParams(args[1], frame) end local params = {} for k,v in ipairs(args) do if k > 2 then params[k-2] = v end end return map(args[2], #params ~= 0 and params) end local hemisphereMultipliers = { longitude = { W = -1, w = -1, E = 1, e = 1 }, latitude = { S = -1, s = -1, N = 1, n = 1 } } local function decdeg(degrees, minutes, seconds, hemisphere, decimal, direction) if decimal then if degrees then error('Decimal and DMS degrees cannot both be provided for ' .. direction, 2) elseif minutes then error('Minutes can only be provided with DMS degrees for ' .. direction, 2) elseif seconds then error('Seconds can only be provided with DMS degrees for ' .. direction, 2) elseif hemisphere then error('A hemisphere can only be provided with DMS degrees for ' .. direction, 2) end local retval = tonumber(decimal) if retval then return retval end error('The value "' .. decimal .. '" provided for ' .. direction .. ' is not valid', 2) elseif seconds and not minutes then error('Seconds were provided for ' .. direction .. ' without minutes also being provided', 2) elseif not degrees then if minutes then error('Minutes were provided for ' .. direction .. ' without degrees also being provided', 2) elseif hemisphere then error('A hemisphere was provided for ' .. direction .. ' without degrees also being provided', 2) end return nil end decimal = tonumber(degrees) if not decimal then error('The degree value "' .. degrees .. '" provided for ' .. direction .. ' is not valid', 2) elseif minutes and not tonumber(minutes) then error('The minute value "' .. minutes .. '" provided for ' .. direction .. ' is not valid', 2) elseif seconds and not tonumber(seconds) then error('The second value "' .. seconds .. '" provided for ' .. direction .. ' is not valid', 2) end decimal = decimal + (minutes or 0)/60 + (seconds or 0)/3600 if hemisphere then local multiplier = hemisphereMultipliers[direction][hemisphere] if not multiplier then error('The hemisphere "' .. hemisphere .. '" provided for ' .. direction .. ' is not valid', 2) end decimal = decimal * multiplier end return decimal end -- Finds a parameter in a transclusion of {{Coord}}. local function coord2text(para,coord) -- this should be changed for languages which do not use Arabic numerals or the degree sign local lat, long = mw.ustring.match(coord,'<span class="p%-latitude latitude">([^<]+)</span><span class="p%-longitude longitude">([^<]+)</span>') if lat then return tonumber(para == 'longitude' and long or lat) end local result = mw.text.split(mw.ustring.match(coord,'%-?[%.%d]+°[NS] %-?[%.%d]+°[EW]') or '', '[ °]') if para == 'longitude' then result = {result[3], result[4]} end if not tonumber(result[1]) or not result[2] then mw.log('Malformed coordinates value') mw.logObject(para, 'para') mw.logObject(coord, 'coord') return error('Malformed coordinates value', 2) end return tonumber(result[1]) * hemisphereMultipliers[para][result[2]] end -- effectively make removeBlanks false for caption and maplink, and true for everything else -- if useWikidata is present but blank, convert it to false instead of nil -- p.top, p.bottom, and their callers need to use this function p.valueFunc(key, value) if value then value = mw.text.trim(value) end if value ~= '' or key == 'caption' or key == 'maplink' then return value elseif key == 'useWikidata' then return false end end local function getContainerImage(args, map) if args.AlternativeMap then return args.AlternativeMap elseif args.relief then local digits = mw.ustring.match(args.relief,'^[1-9][0-9]?$') or '1' -- image1 to image99 if map('image' .. digits) ~= '' then return map('image' .. digits) end end return map('image') end function p.top(frame, args, map) if not args then args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc}) end if not map then map = p.getMapParams(args[1], frame) end local width local default_as_number = tonumber(mw.ustring.match(tostring(args.default_width),"%d*")) if not args.width then width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1)) elseif mw.ustring.sub(args.width, -2) == 'px' then width = mw.ustring.sub(args.width, 1, -3) else width = args.width end local width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0; if width_as_number == 0 then -- check to see if width is junk. If it is, then use default calculation width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1)) width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0; end if args.max_width ~= "" and args.max_width ~= nil then -- check to see if width bigger than max_width local max_as_number = tonumber(mw.ustring.match(args.max_width,"%d*")) or 0; if width_as_number>max_as_number and max_as_number>0 then width = args.max_width; end end local retval = frame:extensionTag{name = 'templatestyles', args = {src = 'Module:Location map/styles.css'}} if args.float == 'center' then retval = retval .. '<div class="center">' end if args.caption and args.caption ~= '' and args.border ~= 'infobox' then retval = retval .. '<div class="locmap noviewer noresize thumb ' if args.float == '"left"' or args.float == 'left' then retval = retval .. 'tleft' elseif args.float == '"center"' or args.float == 'center' or args.float == '"none"' or args.float == 'none' then retval = retval .. 'tnone' else retval = retval .. 'tright' end retval = retval .. '"><div class="thumbinner" style="width:' .. (width + 2) .. 'px' if args.border == 'none' then retval = retval .. ';border:none' elseif args.border then retval = retval .. ';border-color:' .. args.border end retval = retval .. '"><div style="position:relative;width:' .. width .. 'px' .. (args.border ~= 'none' and ';border:1px solid lightgray">' or '">') else retval = retval .. '<div class="locmap" style="width:' .. width .. 'px;' if args.float == '"left"' or args.float == 'left' then retval = retval .. 'float:left;clear:left' elseif args.float == '"center"' or args.float == 'center' then retval = retval .. 'float:none;clear:both;margin-left:auto;margin-right:auto' elseif args.float == '"none"' or args.float == 'none' then retval = retval .. 'float:none;clear:none' else retval = retval .. 'float:right;clear:right' end retval = retval .. '"><div style="width:' .. width .. 'px;padding:0"><div style="position:relative;width:' .. width .. 'px">' end local image = getContainerImage(args, map) local currentTitle = mw.title.getCurrentTitle() retval = string.format( '%s[[File:%s|%spx|%s%s|class=notpageimage]]', retval, image, width, args.alt or ((args.label or currentTitle.text) .. ' is located in ' .. map('name')), args.maplink and ('|link=' .. args.maplink) or '' ) if args.caption and args.caption ~= '' then if (currentTitle.namespace == 0) and mw.ustring.find(args.caption, '##') then retval = retval .. '[[Category:Pages using location map with a double number sign in the caption]]' end end if args.overlay_image then return retval .. '<div style="position:absolute;top:0;left:0">[[File:' .. args.overlay_image .. '|' .. width .. 'px|class=notpageimage]]</div>' else return retval end end function p.bottom(frame, args, map) if not args then args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc}) end if not map then map = p.getMapParams(args[1], frame) end local retval = '</div>' local currentTitle = mw.title.getCurrentTitle() if not args.caption or args.border == 'infobox' then if args.border then retval = retval .. '<div style="padding-top:0.2em">' else retval = retval .. '<div style="font-size:91%;padding-top:3px">' end retval = retval .. (args.caption or (args.label or currentTitle.text) .. ' (' .. map('name') .. ')') .. '</div>' elseif args.caption ~= '' then -- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '|class=notpageimage| ]]</div>' .. args.caption .. '</div>' end if args.switcherLabel then retval = retval .. '<span class="switcher-label" style="display:none">' .. args.switcherLabel .. '</span>' elseif args.autoSwitcherLabel then retval = retval .. '<span class="switcher-label" style="display:none">Show map of ' .. map('name') .. '</span>' end retval = retval .. '</div></div>' if args.caption_undefined then mw.log('Removed parameter caption_undefined used.') local parent = frame:getParent() if parent then mw.log('Parent is ' .. parent:getTitle()) end mw.logObject(args, 'args') if currentTitle.namespace == 0 then retval = retval .. '[[Category:Location maps with removed parameters|caption_undefined]]' end end if map('skew') ~= '' or map('lat_skew') ~= '' or map('crosses180') ~= '' or map('type') ~= '' then mw.log('Removed parameter used in map definition ' .. map()) if currentTitle.namespace == 0 then local key = (map('skew') ~= '' and 'skew' or '') .. (map('lat_skew') ~= '' and 'lat_skew' or '') .. (map('crosses180') ~= '' and 'crosses180' or '') .. (map('type') ~= '' and 'type' or '') retval = retval .. '[[Category:Location maps with removed parameters|' .. key .. ' ]]' end end if string.find(map('name'), '|', 1, true) then mw.log('Pipe used in name of map definition ' .. map()) if currentTitle.namespace == 0 then retval = retval .. '[[Category:Location maps with a name containing a pipe]]' end end if args.float == 'center' then retval = retval .. '</div>' end return retval end local function markOuterDiv(x, y, imageDiv, labelDiv) return mw.html.create('div') :addClass('od') :cssText('top:' .. round(y, 3) .. '%;left:' .. round(x, 3) .. '%') :node(imageDiv) :node(labelDiv) end local function markImageDiv(mark, marksize, label, link, alt, title) local builder = mw.html.create('div') :addClass('id') :cssText('left:-' .. round(marksize / 2) .. 'px;top:-' .. round(marksize / 2) .. 'px') :attr('title', title) if marksize ~= 0 then builder:wikitext(string.format( '[[File:%s|%dx%dpx|%s|link=%s%s|class=notpageimage]]', mark, marksize, marksize, label, link, alt and ('|alt=' .. alt) or '' )) end return builder end local function markLabelDiv(label, label_size, label_width, position, background, x, marksize) if tonumber(label_size) == 0 then return mw.html.create('div'):addClass('l0'):wikitext(label) end local builder = mw.html.create('div') :cssText('font-size:' .. label_size .. '%;width:' .. label_width .. 'em') local distance = round(marksize / 2 + 1) if position == 'top' then -- specified top builder:addClass('pv'):cssText('bottom:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em') elseif position == 'bottom' then -- specified bottom builder:addClass('pv'):cssText('top:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em') elseif position == 'left' or (tonumber(x) > 70 and position ~= 'right') then -- specified left or autodetected to left builder:addClass('pl'):cssText('right:' .. distance .. 'px') else -- specified right or autodetected to right builder:addClass('pr'):cssText('left:' .. distance .. 'px') end builder = builder:tag('div') :wikitext(label) if background then builder:cssText('background-color:' .. background) end return builder:done() end local function getX(longitude, left, right) local width = (right - left) % 360 if width == 0 then width = 360 end local distanceFromLeft = (longitude - left) % 360 -- the distance needed past the map to the right equals distanceFromLeft - width. the distance needed past the map to the left equals 360 - distanceFromLeft. to minimize page stretching, go whichever way is shorter if distanceFromLeft - width / 2 >= 180 then distanceFromLeft = distanceFromLeft - 360 end return 100 * distanceFromLeft / width end local function getY(latitude, top, bottom) return 100 * (top - latitude) / (top - bottom) end function p.mark(frame, args, map) if not args then args = getArgs(frame, {wrappers = 'Template:Location map~'}) end local mapnames = {} if not map then if args[1] then map = {} for mapname in mw.text.gsplit(args[1], '#', true) do map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame) mapnames[#mapnames + 1] = mapname end if #map == 1 then map = map[1] end else map = p.getMapParams('World', frame) args[1] = 'World' end end if type(map) == 'table' then local outputs = {} local oldargs = args[1] for k,v in ipairs(map) do args[1] = mapnames[k] outputs[k] = tostring(p.mark(frame, args, v)) end args[1] = oldargs return table.concat(outputs, '#PlaceList#') .. '#PlaceList#' end local x, y, longitude, latitude longitude = decdeg(args.lon_deg, args.lon_min, args.lon_sec, args.lon_dir, args.long, 'longitude') latitude = decdeg(args.lat_deg, args.lat_min, args.lat_sec, args.lat_dir, args.lat, 'latitude') if args.excludefrom then -- If this mark is to be excluded from certain maps entirely (useful in the context of multiple maps) for exclusionmap in mw.text.gsplit(args.excludefrom, '#', true) do -- Check if this map is excluded. If so, return an empty string. if args[1] == exclusionmap then return '' end end end local builder = mw.html.create() local currentTitle = mw.title.getCurrentTitle() if args.coordinates then -- Temporarily removed to facilitate infobox conversion. See [[Wikipedia:Coordinates in infoboxes]] -- if longitude or latitude then -- error('Coordinates from [[Module:Coordinates]] and individual coordinates cannot both be provided') -- end longitude = coord2text('longitude', args.coordinates) latitude = coord2text('latitude', args.coordinates) elseif not longitude and not latitude and args.useWikidata then -- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't. local entity = mw.wikibase.getEntity() if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then local value = entity.claims.P625[1].mainsnak.datavalue.value longitude, latitude = value.longitude, value.latitude end if args.link and (currentTitle.namespace == 0) then builder:wikitext('[[Category:Location maps with linked markers with coordinates from Wikidata]]') end end if not longitude then error('No value was provided for longitude') elseif not latitude then error('No value was provided for latitude') end if currentTitle.namespace > 0 then if (not args.lon_deg) ~= (not args.lat_deg) then builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Degrees]]') elseif (not args.lon_min) ~= (not args.lat_min) then builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Minutes]]') elseif (not args.lon_sec) ~= (not args.lat_sec) then builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Seconds]]') elseif (not args.lon_dir) ~= (not args.lat_dir) then builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Hemisphere]]') elseif (not args.long) ~= (not args.lat) then builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Decimal]]') end end if ((tonumber(args.lat_deg) or 0) < 0) and ((tonumber(args.lat_min) or 0) ~= 0 or (tonumber(args.lat_sec) or 0) ~= 0 or (args.lat_dir and args.lat_dir ~='')) then builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]') end if ((tonumber(args.lon_deg) or 0) < 0) and ((tonumber(args.lon_min) or 0) ~= 0 or (tonumber(args.lon_sec) or 0) ~= 0 or (args.lon_dir and args.lon_dir ~= '')) then builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]') end if (((tonumber(args.lat_min) or 0) < 0) or ((tonumber(args.lat_sec) or 0) < 0)) then builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]') end if (((tonumber(args.lon_min) or 0) < 0) or ((tonumber(args.lon_sec) or 0) < 0)) then builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]') end if args.skew or args.lon_shift or args.markhigh then mw.log('Removed parameter used in invocation.') local parent = frame:getParent() if parent then mw.log('Parent is ' .. parent:getTitle()) end mw.logObject(args, 'args') if currentTitle.namespace == 0 then local key = (args.skew and 'skew' or '') .. (args.lon_shift and 'lon_shift' or '') .. (args.markhigh and 'markhigh' or '') builder:wikitext('[[Category:Location maps with removed parameters|' .. key ..' ]]') end end if map('x') ~= '' then x = tonumber(mw.ext.ParserFunctions.expr(map('x', { latitude, longitude }))) else x = tonumber(getX(longitude, map('left'), map('right'))) end if map('y') ~= '' then y = tonumber(mw.ext.ParserFunctions.expr(map('y', { latitude, longitude }))) else y = tonumber(getY(latitude, map('top'), map('bottom'))) end if (x < 0 or x > 100 or y < 0 or y > 100) and not args.outside then mw.log('Mark placed outside map boundaries without outside flag set. x = ' .. x .. ', y = ' .. y) local parent = frame:getParent() if parent then mw.log('Parent is ' .. parent:getTitle()) end mw.logObject(args, 'args') if currentTitle.namespace == 0 then local key = currentTitle.prefixedText builder:wikitext('[[Category:Location maps with marks outside map and outside parameter not set|' .. key .. ' ]]') end end local mark = args.mark or map('mark') if mark == '' then mark = 'Red pog.svg' end local marksize = tonumber(args.marksize) or tonumber(map('marksize')) or 8 local imageDiv = markImageDiv(mark, marksize, args.label or mw.title.getCurrentTitle().text, args.link or '', args.alt, args[2]) local labelDiv if args.label and args.position ~= 'none' then labelDiv = markLabelDiv(args.label, args.label_size or 91, args.label_width or 6, args.position, args.background, x, marksize) end return builder:node(markOuterDiv(x, y, imageDiv, labelDiv)) end local function switcherSeparate(s) if s == nil then return {} end local retval = {} for i in string.gmatch(s .. '#', '([^#]*)#') do i = mw.text.trim(i) retval[#retval + 1] = (i ~= '' and i) end return retval end function p.main(frame, args, map) local caption_list = {} if not args then args = getArgs(frame, {wrappers = 'Template:Location map', valueFunc = p.valueFunc}) end if args.useWikidata == nil then args.useWikidata = true end if not map then if args[1] then map = {} for mapname in string.gmatch(args[1], '[^#]+') do map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame) end if args['caption'] then if args['caption'] == "" then while #caption_list < #map do caption_list[#caption_list + 1] = args['caption'] end else for caption in mw.text.gsplit(args['caption'], '##', true) do caption_list[#caption_list + 1] = caption end end end if #map == 1 then map = map[1] end else map = p.getMapParams('World', frame) end end if type(map) == 'table' then local altmaps = switcherSeparate(args.AlternativeMap) if #altmaps > #map then error(string.format('%d AlternativeMaps were provided, but only %d maps were provided', #altmaps, #map)) end local overlays = switcherSeparate(args.overlay_image) if #overlays > #map then error(string.format('%d overlay_images were provided, but only %d maps were provided', #overlays, #map)) end if #caption_list > #map then error(string.format('%d captions were provided, but only %d maps were provided', #caption_list, #map)) end local outputs = {} args.autoSwitcherLabel = true for k,v in ipairs(map) do args.AlternativeMap = altmaps[k] args.overlay_image = overlays[k] args.caption = caption_list[k] outputs[k] = p.main(frame, args, v) end return '<div class="switcher-container">' .. table.concat(outputs) .. '</div>' else return p.top(frame, args, map) .. tostring( p.mark(frame, args, map) ) .. p.bottom(frame, args, map) end end return p e4ccfcc6e71c45a4355aa7240a0a8b81dc19f8eb Template:Location map 10 39 60 2023-12-17T12:06:40Z BaiatArbore 2 Created page with "<includeonly>{{#invoke:Location map|main}}</includeonly><noinclude>{{documentation}}</noinclude>" wikitext text/x-wiki <includeonly>{{#invoke:Location map|main}}</includeonly><noinclude>{{documentation}}</noinclude> 732416b8068d2dc3549db5aa5ffa786beb502886 Module:Location map/data/World 828 40 61 2023-12-17T12:08:20Z BaiatArbore 2 Created page with "return require('Module:Location map/data/Earth')" Scribunto text/plain return require('Module:Location map/data/Earth') f74c5ded1527213d32d9e784476230047c944f81 Module:Location map/data/Earth 828 41 62 2023-12-17T12:08:59Z BaiatArbore 2 Created page with "return { name = 'Earth', top = 90, bottom = -90, left = -180, right = 180, image = 'World location map (equirectangular 180).svg', image1='World location map (equirectangular 180).svg'}" Scribunto text/plain return { name = 'Earth', top = 90, bottom = -90, left = -180, right = 180, image = 'World location map (equirectangular 180).svg', image1='World location map (equirectangular 180).svg'} 0c7a9c4349065ea43134d0a61037d31862f2a042 United Kingdom 0 3 63 21 2023-12-17T16:49:51Z BaiatArbore 2 wikitext text/x-wiki The '''United Kingdom''', officially known as the '''United Kingdom of Great Britain and Northern Ireland''' is a country in [[North-Western Europe]] in the [[British Isles]] Archipelago. It's made up of 4 countries - [[England]], [[Scotland]], [[Wales]], and [[Northern Ireland]], and it covers the island of [[Great Britain]], the north-eastern part of the island of [[Ireland]] and other less important islands in the archipelago. The country borders the [[Republic of Ireland]], however it's also encompassed by the [[Atlantic Ocean]]. 2701c2f9379385d8e9177ce26f06608f64251038 Poland 0 42 64 2023-12-17T16:55:33Z BaiatArbore 2 Created page with "'''Poland''' is a country in Central Europe. It is divided into 16 administrative divisions called voivodeships." wikitext text/x-wiki '''Poland''' is a country in Central Europe. It is divided into 16 administrative divisions called voivodeships. 2f69f30b4a2e29d88a67ac69a71c4a2be4c84ab7 99 64 2023-12-18T14:53:05Z BaiatArbore 2 add longer description wikitext text/x-wiki '''Poland''' is a large country in [[Central Europe]], divided into 16 administrative provinces called [[voivodeships]]. It's located on the [[Great European Plain]], and is divided into 5 geographical sections - the seashore, the lake district, the lowlands, the highlands, and the mountains. It's one of the most populous countries in the [[European Union]] and it's currently led by president [[Andrzej Duda]] and premier [[Donald Tusk]]. 7b344af05978ad39493a4479fe5143750f37a549 100 99 2023-12-18T19:07:02Z BaiatArbore 2 wikitext text/x-wiki '''Poland''' is a large country in [[Central Europe]], divided into 16 administrative provinces called [[voivodeships]]. It's located on the [[Great European Plain]], and is divided into 5 geographical sections - the seashore, the lake district, the lowlands, the highlands, and the mountains. It's one of the most populous countries in the [[European Union]] and is currently led by president [[Andrzej Duda]] and premier [[Donald Tusk]]. ce23ff2f84c559073d7f775a8c43e4c5f5c106a3 Template:Coord 10 43 65 2023-12-17T17:01:52Z BaiatArbore 2 Created page with "<includeonly>{{#invoke:Coordinates|coord}}</includeonly><noinclude> {{Documentation}} <!-- Add categories to the /doc subpage, interwikis to Wikidata, not here --> </noinclude>" wikitext text/x-wiki <includeonly>{{#invoke:Coordinates|coord}}</includeonly><noinclude> {{Documentation}} <!-- Add categories to the /doc subpage, interwikis to Wikidata, not here --> </noinclude> 05c1e2a95ff86fa91442c704f36a9f125b603492 Module:Coordinates/styles.css 828 44 67 2023-12-17T17:03:18Z BaiatArbore 2 Created page with "/* {{pp-template}} */ /* Geographical coordinates defaults. The classes "geo", "longitude", and "latitude" are used by the [[Geo microformat]]. */ .geo-default, .geo-dms, .geo-dec { display: inline; } .geo-nondefault, .geo-multi-punct, .geo-inline-hidden { display: none; } .longitude, .latitude { white-space: nowrap; }" sanitized-css text/css /* {{pp-template}} */ /* Geographical coordinates defaults. The classes "geo", "longitude", and "latitude" are used by the [[Geo microformat]]. */ .geo-default, .geo-dms, .geo-dec { display: inline; } .geo-nondefault, .geo-multi-punct, .geo-inline-hidden { display: none; } .longitude, .latitude { white-space: nowrap; } 1b5d036501a9f6bc9dcf3c9117e8d6bc97507290 Module:ISO 3166 828 45 70 2023-12-17T17:06:27Z BaiatArbore 2 Created page with "-- to enable us to replicate the current functioning of Country extract, we need to deal with: -- 2 {{<name>}} DONE! -- 3 [[<name>]] DONE! -- 4 [[<name>|<junk>]] DONE! -- 5 [[image:flag of <country>.[svg|gif|png|jpg]|\d+px]] DONE! local p = {} local getArgs = require("Module:Arguments").getArgs local data = mw.loadData("Module:ISO 3166/data/National") --[[----------F I N D N A M E----------]]-- -- Finds the name in the database local function findname(code,cd..." Scribunto text/plain -- to enable us to replicate the current functioning of Country extract, we need to deal with: -- 2 {{<name>}} DONE! -- 3 [[<name>]] DONE! -- 4 [[<name>|<junk>]] DONE! -- 5 [[image:flag of <country>.[svg|gif|png|jpg]|\d+px]] DONE! local p = {} local getArgs = require("Module:Arguments").getArgs local data = mw.loadData("Module:ISO 3166/data/National") --[[----------F I N D N A M E----------]]-- -- Finds the name in the database local function findname(code,cdata,qry) local sqry = p.strip(qry) if cdata["name"] and sqry==p.strip(cdata["name"]) or cdata["isoname"] and sqry==p.strip(cdata["isoname"]) or not cdata["nocode"] and sqry==code or sqry==cdata["alpha3"] or sqry==cdata["numeric"] then return true end for _,tname in pairs(cdata["isonames"] or {}) do if sqry==p.strip(tname) then return true end end for _,tname in pairs(cdata["altnames"] or {}) do if sqry==p.strip(tname) then return true end end return false end --[[----------I S O N A M E----------]]-- -- Find the ISO name of a country/region local function isoname(data,code,lang) if data[code]["isonames"] then local name = data[code]["isodisplaynames"] and data[code]["isodisplaynames"][lang] or data[code]["isonames"][lang] or data[code]["isodisplaynames"] and data[code]["isodisplaynames"][data[code]["defaultlang"] or data["defaultlang"]] or data[code]["isonames"][data[code]["defaultlang"] or data["defaultlang"]] or data[code]["isodisplaynames"] and data[code]["isodisplaynames"]["en"] or data[code]["isonames"]["en"] if name then return name end for _,iname in pairs(data[code]["isonames"]) do return iname end return data[code]["isodisplayname"] or data[code]["isoname"] else return data[code]["isodisplayname"] or data[code]["isoname"] end end --[[----------S T R I P----------]]-- -- Removes junk from the input function p.strip(text) local accents = {["À"]="A",["Á"]="A",["Â"]="A",["Ã"]="A", -- accent list ["Ä"]="A",["Å"]="A",["Ç"]="C",["È"]="E",["É"]="E", ["Ê"]="E",["Ë"]="E",["Ì"]="I",["Í"]="I",["Î"]="I", ["Ï"]="I",["Ñ"]="N",["Ò"]="O",["Ó"]="O",["Ô"]="O", ["Õ"]="O",["Ö"]="O",["Ø"]="O",["Ù"]="U",["Ú"]="U", ["Û"]="U",["Ü"]="U",["Ý"]="Y" } local remove = {"NATION OF","COUNTRY OF","TERRITORY OF", -- text to be removed list "FLAG OF","FLAG","KINGDOM OF","STATE OF"," STATE ", "PROVINCE OF","PROVINCE","TERRITORY" } local patterns = {[".+:"]="",["|.+"]="",["%(.-%)"]="", -- patterns to follow (order may matter) ["%..*"]="",["^THE "]="",["%_"]=" ",["%-"]=" ", ["%d%d?%d?PX"]="", } text = mw.ustring.upper(text) -- Case insensitivity text = mw.ustring.gsub(text,"[À-Ý]",accents) -- Deaccent for pattern,value in pairs(patterns) do -- Follow patterns text = mw.ustring.gsub(text,pattern,value) end for _,words in pairs(remove) do -- Remove unneeded words text = mw.ustring.gsub(text,words,"") end text = mw.ustring.gsub(text,"%W","") -- Remove non alpha-numeric return text end --[[----------P . C A L L S T R I P ---------]]-- -- Calls P.strip but using Module:Arguments function p.callstrip(frame) local args = getArgs(frame) return p.strip(args[1]) or "" end --[[----------P . L U A C O D E---------]]-- -- Makes the ISO code of a country function p.luacode(args) if string.find(args[1] or '',"%-") then args[1], args[2] = string.match(args[1] or '',"^([^%-]*)%-(.*)$") end if args[1] then args[1] = p.strip(args[1]) end if args[2] then args[2] = p.strip(args[2]) end if args["codetype"]=="3" then args["codetype"]="alpha3" end local eot = args.error or "" local catnocountry = (args.nocat and args.nocat == 'true') and '' or '[[Category:Wikipedia page with obscure country]]' local catnosubdivision = (args.nocat and args.nocat == 'true') and '' or '[[Category:Wikipedia page with obscure subdivision]]' if not args[1] then if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end return catnocountry, '<span style="font-size:100%" class="error">"No parameter for the country given"</span>' end if not args[2] then --3166-1 code for alpha2,cdata in pairs(data) do if findname(alpha2,cdata,args[1]) then if args["codetype"]=="numeric" or args["codetype"]=="alpha3" then return cdata[args["codetype"]] else return alpha2 end end end if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end return catnocountry else --3166-2 code for alpha2,cdata in pairs(data) do if findname(alpha2,cdata,args[1]) then if mw.ustring.match(alpha2,"GB") then -- For England, Wales etc. alpha2 = "GB" end local sdata = mw.loadData("Module:ISO 3166/data/"..alpha2) local empty = true for scode,scdata in pairs(sdata) do if type(scdata)=="table" then empty = false if findname(scode,scdata,args[2]) then return alpha2.."-"..scode end end end if mw.title.getCurrentTitle().namespace ~= 0 then catnosubdivision = '' end return catnosubdivision end end if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end return catnocountry end end --[[----------P . C O D E---------]]-- -- Calls P.Luacode but using Module:Arguments function p.code(frame) return p.luacode(getArgs(frame)) or "" end --[[----------P . N U M E R I C---------]]-- -- Calls P.Luacode but using Module:Arguments and setting it to output a numeric value function p.numeric(frame) local args = getArgs(frame) args["codetype"]="numeric" return p.luacode(args) or "" end --[[----------P . L U A N A M E---------]]-- -- Makes the ISO/common name of a country function p.luaname(args) local code1 = p.luacode(args) local code2 = '' if string.find(code1,"%-") then code1, code2 = string.match(code1,"^([^%-]*)%-(.*)$") end if string.find(code1,"^%u%u$") then if code2=="" then --3166-1 alpha-2 code if data[code1] then return (args.isoname or args.lang) and isoname(data,code1,args.lang) or (data[code1]["displayname"] or data[code1]["name"]) else return '[[Category:Wikipedia page with obscure country]]' end else --3166-2 code local sdata if data[code1] then sdata = mw.loadData("Module:ISO 3166/data/"..code1) else return '[[Category:Wikipedia page with obscure country]]' end if sdata[code2] then return (args.isoname or args.lang) and isoname(sdata,code2,args.lang) or (sdata[code2]["displayname"] or sdata[code2]["name"]) else return '[[Category:Wikipedia page with obscure country]]' end end end end --[[----------P . N A M E---------]]-- -- Calls P.Luaname but using Module:Arguments function p.name(frame) return p.luaname(getArgs(frame)) or "" end --[[----------P . G E O C O O R D I N S E R T---------]]-- -- Wrapper for Module:Coordinates.coordinsert function p.geocoordinsert(frame) -- {{#invoke:ISO 3166|geocoordinsert|{{coord|...}} -- |country=..|subdivision1=...|subdivision2=... -- |type=...|scale=...|dim=...|source=...|globe=... -- }} local args = frame.args local subdivisionqueried = false local catnocountry = (args.nocat and args.nocat == 'true') and '' or '[[Category:Wikipedia page with obscure country]]' local catnosubdivision = (args.nocat and args.nocat == 'true') and '' or '[[Category:Wikipedia page with obscure subdivision]]' or '' local tracking = '' local targs = {} targs[1] = args[1] or '' for i, v in pairs(args) do if i == 'country' and not mw.ustring.find(targs[1], 'region:') then local country = v local k, region = 1, '' -- look for a valid subdivision while region == '' and k < 3 do local subdivision = args['subdivision' .. k] or '' if subdivision ~= '' then region = p.luacode({country, subdivision, nocat = 'true'}) subdivisionqueried = true end k = k + 1 end -- subdivision lookup failed or never attempted, try country only if region == '' then region = p.luacode({country, nocat = 'true'}) if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry, catnosubdivision = '', '' end if region == '' then tracking = tracking .. catnocountry elseif subdivisionqueried == true then tracking = tracking .. catnosubdivision end end -- something worked, add it to the targs if region ~= '' then targs[#targs + 1] = 'region:' .. region end elseif i == 'type' or i == 'scale' or i == 'dim' or i == 'source' or i == 'globe' then targs[#targs + 1] = i .. ':' .. v end end -- call Module:Coordinates.coordinsert if there is something to insert if #targs > 1 then local coordinsert = require('Module:Coordinates').coordinsert return coordinsert({args = targs}) .. tracking end -- otherwise, just return the coordinates return targs[1] .. tracking end return p 6bc354f2610f29e712065cbe3ea814144fa3a600 Module:ISO 3166/data/National 828 46 71 2023-12-17T17:07:29Z BaiatArbore 2 Created page with "return { ["AD"] = {alpha3="AND",numeric="020",name="Andorra"}, ["AE"] = {alpha3="ARE",numeric="784",name="United Arab Emirates",altnames={"UAE"}}, ["AF"] = {alpha3="AFG",numeric="004",name="Afghanistan"}, ["AG"] = {alpha3="ATG",numeric="028",name="Antigua and Barbuda"}, ["AI"] = {alpha3="AIA",numeric="660",name="Anguilla"}, ["AL"] = {alpha3="ALB",numeric="008",name="Albania"}, ["AM"] = {alpha3="ARM",numeric="051",name="Armenia"}, ["AO"] = {alpha3="AGO",nu..." Scribunto text/plain return { ["AD"] = {alpha3="AND",numeric="020",name="Andorra"}, ["AE"] = {alpha3="ARE",numeric="784",name="United Arab Emirates",altnames={"UAE"}}, ["AF"] = {alpha3="AFG",numeric="004",name="Afghanistan"}, ["AG"] = {alpha3="ATG",numeric="028",name="Antigua and Barbuda"}, ["AI"] = {alpha3="AIA",numeric="660",name="Anguilla"}, ["AL"] = {alpha3="ALB",numeric="008",name="Albania"}, ["AM"] = {alpha3="ARM",numeric="051",name="Armenia"}, ["AO"] = {alpha3="AGO",numeric="024",name="Angola"}, ["AQ"] = {alpha3="ATA",numeric="010",name="Antarctica"}, ["AR"] = {alpha3="ARG",numeric="032",name="Argentina"}, ["AS"] = {alpha3="ASM",numeric="016",name="American Samoa"}, ["AT"] = {alpha3="AUT",numeric="040",name="Austria"}, ["AU"] = {alpha3="AUS",numeric="036",name="Australia"}, ["AW"] = {alpha3="ABW",numeric="533",name="Aruba"}, ["AX"] = {alpha3="ALA",numeric="248",name="Åland Islands",altnames={"Aland Islands","Åland","Aland"}}, ["AZ"] = {alpha3="AZE",numeric="031",name="Azerbaijan"}, ["BA"] = {alpha3="BIH",numeric="070",name="Bosnia and Herzegovina",altnames={"Bosnia"}}, ["BB"] = {alpha3="BRB",numeric="052",name="Barbados"}, ["BD"] = {alpha3="BGD",numeric="050",name="Bangladesh"}, ["BE"] = {alpha3="BEL",numeric="056",name="Belgium"}, ["BF"] = {alpha3="BFA",numeric="854",name="Burkina Faso"}, ["BG"] = {alpha3="BGR",numeric="100",name="Bulgaria"}, ["BH"] = {alpha3="BHR",numeric="048",name="Bahrain"}, ["BI"] = {alpha3="BDI",numeric="108",name="Burundi"}, ["BJ"] = {alpha3="BEN",numeric="204",name="Benin"}, ["BL"] = {alpha3="BLM",numeric="652",name="Saint Barthélemy",altnames={"St Barthelemy"}}, ["BM"] = {alpha3="BMU",numeric="060",name="Bermuda"}, ["BN"] = {alpha3="BRN",numeric="096",name="Brunei",isoname="Brunei Darussalam"}, ["BO"] = {alpha3="BOL",numeric="068",name="Bolivia",isoname="Bolivia (Plurinational State of)"}, ["BQ"] = {alpha3="BES",numeric="535",name="Caribbean Netherlands",isoname="Bonaire, Sint Eustatius and Saba"}, ["BR"] = {alpha3="BRA",numeric="076",name="Brazil"}, ["BS"] = {alpha3="BHS",numeric="044",name="Bahamas"}, ["BT"] = {alpha3="BTN",numeric="064",name="Bhutan"}, ["BV"] = {alpha3="BVT",numeric="074",name="Bouvet Island"}, ["BW"] = {alpha3="BWA",numeric="072",name="Botswana"}, ["BY"] = {alpha3="BLR",numeric="112",name="Belarus"}, ["BZ"] = {alpha3="BLZ",numeric="084",name="Belize"}, ["CA"] = {alpha3="CAN",numeric="124",name="Canada"}, ["CC"] = {alpha3="CCK",numeric="166",name="Cocos (Keeling) Islands",altnames={"Cocos Islands","Keeling Islands"}}, ["CD"] = {alpha3="COD",numeric="180",name="Democratic Republic of the Congo",isoname="Congo, Democratic Republic of the",altnames={"Congo-Kinshasa","DRC","DR Congo"}}, ["CF"] = {alpha3="CAF",numeric="140",name="Central African Republic",altnames={"CAR"}}, ["CG"] = {alpha3="COG",numeric="178",name="Republic of the Congo",isoname="Congo",altnames={"Congo-Brazzaville"}}, ["CH"] = {alpha3="CHE",numeric="756",name="Switzerland"}, ["CI"] = {alpha3="CIV",numeric="384",name="Côte d'Ivoire",altnames={"Ivory Coast"}}, ["CK"] = {alpha3="COK",numeric="184",name="Cook Islands"}, ["CL"] = {alpha3="CHL",numeric="152",name="Chile"}, ["CM"] = {alpha3="CMR",numeric="120",name="Cameroon"}, ["CN"] = {alpha3="CHN",numeric="156",name="China",altnames={"People's Republic of China","PRC"}}, ["CO"] = {alpha3="COL",numeric="170",name="Colombia"}, ["CR"] = {alpha3="CRI",numeric="188",name="Costa Rica"}, ["CU"] = {alpha3="CUB",numeric="192",name="Cuba"}, ["CV"] = {alpha3="CPV",numeric="132",name="Cabo Verde",altnames={"Cape Verde"}}, ["CW"] = {alpha3="CUW",numeric="531",name="Curaçao",altnames={"Curacao"}}, ["CX"] = {alpha3="CXR",numeric="162",name="Christmas Island"}, ["CY"] = {alpha3="CYP",numeric="196",name="Cyprus"}, ["CZ"] = {alpha3="CZE",numeric="203",name="Czech Republic",isoname="Czechia"}, ["DE"] = {alpha3="DEU",numeric="276",name="Germany"}, ["DJ"] = {alpha3="DJI",numeric="262",name="Djibouti"}, ["DK"] = {alpha3="DNK",numeric="208",name="Denmark"}, ["DM"] = {alpha3="DMA",numeric="212",name="Dominica"}, ["DO"] = {alpha3="DOM",numeric="214",name="Dominican Republic"}, ["DZ"] = {alpha3="DZA",numeric="012",name="Algeria"}, ["EC"] = {alpha3="ECU",numeric="218",name="Ecuador"}, ["EE"] = {alpha3="EST",numeric="233",name="Estonia"}, ["EG"] = {alpha3="EGY",numeric="818",name="Egypt"}, ["EH"] = {alpha3="ESH",numeric="732",name="Western Sahara"}, ["ER"] = {alpha3="ERI",numeric="232",name="Eritrea"}, ["ES"] = {alpha3="ESP",numeric="724",name="Spain"}, ["ET"] = {alpha3="ETH",numeric="231",name="Ethiopia"}, ["FI"] = {alpha3="FIN",numeric="246",name="Finland"}, ["FJ"] = {alpha3="FJI",numeric="242",name="Fiji"}, ["FK"] = {alpha3="FLK",numeric="238",name="Falkland Islands",isoname="Falkland Islands (Malvinas)",altnames={"Falklands","Islas Malvinas","Malvinas","Malvinas Islands"}}, ["FM"] = {alpha3="FSM",numeric="583",name="Federated States of Micronesia",isoname="Micronesia (Federated States of)",altnames={"Micronesia"}}, ["FO"] = {alpha3="FRO",numeric="234",name="Faroe Islands",altnames={"Faroer","Faeroer"}}, ["FR"] = {alpha3="FRA",numeric="250",name="France"}, ["GA"] = {alpha3="GAB",numeric="266",name="Gabon"}, ["GB"] = {alpha3="GBR",numeric="826",name="United Kingdom",isoname="United Kingdom of Great Britain and Northern Ireland",altnames={"UK","Great Britain"}}, ["GB-ENG"] = {alpha3="ENG",numeric="000",name="England"}, --Considered to be a country ["GB-NIR"] = {alpha3="NIR",numeric="000",name="Northern Ireland"}, --Considered to be a country ["GB-SCT"] = {alpha3="SCT",numeric="000",name="Scotland"}, --Considered to be a country ["GB-WLS"] = {alpha3="WLS",numeric="000",name="Wales"}, --Considered to be a country ["GB-EAW"] = {alpha3="EAW",numeric="000",name="England and Wales"}, --Considered to be a country ["GD"] = {alpha3="GRD",numeric="308",name="Grenada"}, ["GE"] = {alpha3="GEO",numeric="268",name="Georgia"}, ["GF"] = {alpha3="GUF",numeric="254",name="French Guiana"}, ["GG"] = {alpha3="GGY",numeric="831",name="Guernsey"}, ["GH"] = {alpha3="GHA",numeric="288",name="Ghana"}, ["GI"] = {alpha3="GIB",numeric="292",name="Gibraltar"}, ["GL"] = {alpha3="GRL",numeric="304",name="Greenland"}, ["GM"] = {alpha3="GMB",numeric="270",name="Gambia"}, ["GN"] = {alpha3="GIN",numeric="324",name="Guinea"}, ["GP"] = {alpha3="GLP",numeric="312",name="Guadeloupe"}, ["GQ"] = {alpha3="GNQ",numeric="226",name="Equatorial Guinea"}, ["GR"] = {alpha3="GRC",numeric="300",name="Greece"}, ["GS"] = {alpha3="SGS",numeric="239",name="South Georgia and the South Sandwich Islands"}, ["GT"] = {alpha3="GTM",numeric="320",name="Guatemala"}, ["GU"] = {alpha3="GUM",numeric="316",name="Guam"}, ["GW"] = {alpha3="GNB",numeric="624",name="Guinea-Bissau"}, ["GY"] = {alpha3="GUY",numeric="328",name="Guyana"}, ["HK"] = {alpha3="HKG",numeric="344",name="Hong Kong",altnames={"Hong Kong SAR","HKSAR"}}, ["HM"] = {alpha3="HMD",numeric="334",name="Heard Island and McDonald Islands",altnames={"Heard and McDonald Islands"}}, ["HN"] = {alpha3="HND",numeric="340",name="Honduras"}, ["HR"] = {alpha3="HRV",numeric="191",name="Croatia"}, ["HT"] = {alpha3="HTI",numeric="332",name="Haiti"}, ["HU"] = {alpha3="HUN",numeric="348",name="Hungary"}, ["ID"] = {alpha3="IDN",numeric="360",name="Indonesia"}, ["IE"] = {alpha3="IRL",numeric="372",name="Ireland",altnames={"Republic of Ireland"}}, ["IL"] = {alpha3="ISR",numeric="376",name="Israel"}, ["IM"] = {alpha3="IMN",numeric="833",name="Isle of Man"}, ["IN"] = {alpha3="IND",numeric="356",name="India"}, ["IO"] = {alpha3="IOT",numeric="086",name="British Indian Ocean Territory"}, ["IQ"] = {alpha3="IRQ",numeric="368",name="Iraq"}, ["IR"] = {alpha3="IRN",numeric="364",name="Iran",isoname="Iran (Islamic Republic of)"}, ["IS"] = {alpha3="ISL",numeric="352",name="Iceland"}, ["IT"] = {alpha3="ITA",numeric="380",name="Italy"}, ["JE"] = {alpha3="JEY",numeric="832",name="Jersey"}, ["JM"] = {alpha3="JAM",numeric="388",name="Jamaica"}, ["JO"] = {alpha3="JOR",numeric="400",name="Jordan"}, ["JP"] = {alpha3="JPN",numeric="392",name="Japan"}, ["KE"] = {alpha3="KEN",numeric="404",name="Kenya"}, ["KG"] = {alpha3="KGZ",numeric="417",name="Kyrgyzstan"}, ["KH"] = {alpha3="KHM",numeric="116",name="Cambodia"}, ["KI"] = {alpha3="KIR",numeric="296",name="Kiribati"}, ["KM"] = {alpha3="COM",numeric="174",name="Comoros"}, ["KN"] = {alpha3="KNA",numeric="659",name="Saint Kitts and Nevis",altnames={"St Kitts and Nevis"}}, ["KP"] = {alpha3="PRK",numeric="408",name="North Korea",isoname="Korea (Democratic People's Republic of)",altnames={"Democratic People's Republic of Korea"}}, ["KR"] = {alpha3="KOR",numeric="410",name="South Korea",isoname="Korea, Republic of",altnames={"Republic of Korea"}}, ["KW"] = {alpha3="KWT",numeric="414",name="Kuwait"}, ["KY"] = {alpha3="CYM",numeric="136",name="Cayman Islands"}, ["KZ"] = {alpha3="KAZ",numeric="398",name="Kazakhstan"}, ["LA"] = {alpha3="LAO",numeric="418",name="Laos",isoname="Lao People's Democratic Republic"}, ["LB"] = {alpha3="LBN",numeric="422",name="Lebanon"}, ["LC"] = {alpha3="LCA",numeric="662",name="Saint Lucia",altnames={"St Lucia"}}, ["LI"] = {alpha3="LIE",numeric="438",name="Liechtenstein"}, ["LK"] = {alpha3="LKA",numeric="144",name="Sri Lanka"}, ["LR"] = {alpha3="LBR",numeric="430",name="Liberia"}, ["LS"] = {alpha3="LSO",numeric="426",name="Lesotho"}, ["LT"] = {alpha3="LTU",numeric="440",name="Lithuania"}, ["LU"] = {alpha3="LUX",numeric="442",name="Luxembourg"}, ["LV"] = {alpha3="LVA",numeric="428",name="Latvia"}, ["LY"] = {alpha3="LBY",numeric="434",name="Libya"}, ["MA"] = {alpha3="MAR",numeric="504",name="Morocco"}, ["MC"] = {alpha3="MCO",numeric="492",name="Monaco"}, ["MD"] = {alpha3="MDA",numeric="498",name="Moldova",isoname="Moldova, Republic of"}, ["ME"] = {alpha3="MNE",numeric="499",name="Montenegro"}, ["MF"] = {alpha3="MAF",numeric="663",name="Saint-Martin",isoname="Saint Martin (French part)",altnames={"St Martin","St Martin (French part)","Collectivity of Saint Martin","Collectivity of St Martin"}}, ["MG"] = {alpha3="MDG",numeric="450",name="Madagascar"}, ["MH"] = {alpha3="MHL",numeric="584",name="Marshall Islands"}, ["MK"] = {alpha3="MKD",numeric="807",name="North Macedonia",altnames={"Republic of North Macedonia","Macedonia","Republic of Macedonia","Macedonia, the former Yugoslav Republic of"}}, ["ML"] = {alpha3="MLI",numeric="466",name="Mali"}, ["MM"] = {alpha3="MMR",numeric="104",name="Myanmar",altnames={"Burma"}}, ["MN"] = {alpha3="MNG",numeric="496",name="Mongolia"}, ["MO"] = {alpha3="MAC",numeric="446",name="Macau",isoname="Macao",altnames={"Macau SAR","Macao SAR"}}, ["MP"] = {alpha3="MNP",numeric="580",name="Northern Mariana Islands"}, ["MQ"] = {alpha3="MTQ",numeric="474",name="Martinique"}, ["MR"] = {alpha3="MRT",numeric="478",name="Mauritania"}, ["MS"] = {alpha3="MSR",numeric="500",name="Montserrat"}, ["MT"] = {alpha3="MLT",numeric="470",name="Malta"}, ["MU"] = {alpha3="MUS",numeric="480",name="Mauritius"}, ["MV"] = {alpha3="MDV",numeric="462",name="Maldives"}, ["MW"] = {alpha3="MWI",numeric="454",name="Malawi"}, ["MX"] = {alpha3="MEX",numeric="484",name="Mexico"}, ["MY"] = {alpha3="MYS",numeric="458",name="Malaysia"}, ["MZ"] = {alpha3="MOZ",numeric="508",name="Mozambique"}, ["NA"] = {alpha3="NAM",numeric="516",name="Namibia"}, ["NC"] = {alpha3="NCL",numeric="540",name="New Caledonia"}, ["NE"] = {alpha3="NER",numeric="562",name="Niger"}, ["NF"] = {alpha3="NFK",numeric="574",name="Norfolk Island"}, ["NG"] = {alpha3="NGA",numeric="566",name="Nigeria"}, ["NI"] = {alpha3="NIC",numeric="558",name="Nicaragua"}, ["NL"] = {alpha3="NLD",numeric="528",name="Netherlands"}, ["NO"] = {alpha3="NOR",numeric="578",name="Norway"}, ["NP"] = {alpha3="NPL",numeric="524",name="Nepal"}, ["NR"] = {alpha3="NRU",numeric="520",name="Nauru"}, ["NU"] = {alpha3="NIU",numeric="570",name="Niue"}, ["NZ"] = {alpha3="NZL",numeric="554",name="New Zealand",altnames={"Aotearoa"}}, ["OM"] = {alpha3="OMN",numeric="512",name="Oman"}, ["PA"] = {alpha3="PAN",numeric="591",name="Panama"}, ["PE"] = {alpha3="PER",numeric="604",name="Peru"}, ["PF"] = {alpha3="PYF",numeric="258",name="French Polynesia"}, ["PG"] = {alpha3="PNG",numeric="598",name="Papua New Guinea"}, ["PH"] = {alpha3="PHL",numeric="608",name="Philippines"}, ["PK"] = {alpha3="PAK",numeric="586",name="Pakistan"}, ["PL"] = {alpha3="POL",numeric="616",name="Poland"}, ["PM"] = {alpha3="SPM",numeric="666",name="Saint Pierre and Miquelon",altnames={"St Pierre and Miquelon"}}, ["PN"] = {alpha3="PCN",numeric="612",name="Pitcairn"}, ["PR"] = {alpha3="PRI",numeric="630",name="Puerto Rico"}, ["PS"] = {alpha3="PSE",numeric="275",name="Palestine",isoname="Palestine, State of",altnames={"State of Palestine"}}, ["PT"] = {alpha3="PRT",numeric="620",name="Portugal"}, ["PW"] = {alpha3="PLW",numeric="585",name="Palau"}, ["PY"] = {alpha3="PRY",numeric="600",name="Paraguay"}, ["QA"] = {alpha3="QAT",numeric="634",name="Qatar"}, ["RE"] = {alpha3="REU",numeric="638",name="Réunion"}, ["RO"] = {alpha3="ROU",numeric="642",name="Romania"}, ["RS"] = {alpha3="SRB",numeric="688",name="Serbia"}, ["RU"] = {alpha3="RUS",numeric="643",name="Russia",isoname="Russian Federation"}, ["RW"] = {alpha3="RWA",numeric="646",name="Rwanda"}, ["SA"] = {alpha3="SAU",numeric="682",name="Saudi Arabia"}, ["SB"] = {alpha3="SLB",numeric="090",name="Solomon Islands"}, ["SC"] = {alpha3="SYC",numeric="690",name="Seychelles"}, ["SD"] = {alpha3="SDN",numeric="729",name="Sudan"}, ["SE"] = {alpha3="SWE",numeric="752",name="Sweden"}, ["SG"] = {alpha3="SGP",numeric="702",name="Singapore"}, ["SH"] = {alpha3="SHN",numeric="654",name="Saint Helena, Ascension and Tristan da Cunha"}, ["SI"] = {alpha3="SVN",numeric="705",name="Slovenia"}, ["SJ"] = {alpha3="SJM",numeric="744",name="Svalbard and Jan Mayen"}, ["SK"] = {alpha3="SVK",numeric="703",name="Slovakia"}, ["SL"] = {alpha3="SLE",numeric="694",name="Sierra Leone"}, ["SM"] = {alpha3="SMR",numeric="674",name="San Marino"}, ["SN"] = {alpha3="SEN",numeric="686",name="Senegal"}, ["SO"] = {alpha3="SOM",numeric="706",name="Somalia"}, ["SR"] = {alpha3="SUR",numeric="740",name="Suriname"}, ["SS"] = {alpha3="SSD",numeric="728",name="South Sudan"}, ["ST"] = {alpha3="STP",numeric="678",name="São Tomé and Príncipe",isoname="Sao Tome and Principe",altnames={"Democratic Republic of Sao Tome and Principe"}}, ["SV"] = {alpha3="SLV",numeric="222",name="El Salvador"}, ["SX"] = {alpha3="SXM",numeric="534",name="Sint Maarten",isoname="Sint Maarten (Dutch part)",altnames={"St Maarten","Saint Martin (Dutch part)","St Martin (Dutch part)"}}, ["SY"] = {alpha3="SYR",numeric="760",name="Syria",isoname="Syrian Arab Republic"}, ["SZ"] = {alpha3="SWZ",numeric="748",name="Eswatini",altnames={"Swaziland"}}, ["TC"] = {alpha3="TCA",numeric="796",name="Turks and Caicos Islands"}, ["TD"] = {alpha3="TCD",numeric="148",name="Chad"}, ["TF"] = {alpha3="ATF",numeric="260",name="French Southern and Antarctic Lands",isoname="French Southern Territories"}, ["TG"] = {alpha3="TGO",numeric="768",name="Togo"}, ["TH"] = {alpha3="THA",numeric="764",name="Thailand"}, ["TJ"] = {alpha3="TJK",numeric="762",name="Tajikistan"}, ["TK"] = {alpha3="TKL",numeric="772",name="Tokelau"}, ["TL"] = {alpha3="TLS",numeric="626",name="Timor-Leste",altnames={"East Timor"}}, ["TM"] = {alpha3="TKM",numeric="795",name="Turkmenistan"}, ["TN"] = {alpha3="TUN",numeric="788",name="Tunisia"}, ["TO"] = {alpha3="TON",numeric="776",name="Tonga"}, ["TR"] = {alpha3="TUR",numeric="792",name="Turkey",isoname="Türkiye"}, ["TT"] = {alpha3="TTO",numeric="780",name="Trinidad and Tobago"}, ["TV"] = {alpha3="TUV",numeric="798",name="Tuvalu"}, ["TW"] = {alpha3="TWN",numeric="158",name="Taiwan",isoname="Taiwan, Province of China",altnames={"Republic of China"}}, ["TZ"] = {alpha3="TZA",numeric="834",name="Tanzania",isoname="Tanzania, United Republic of"}, ["UA"] = {alpha3="UKR",numeric="804",name="Ukraine"}, ["UG"] = {alpha3="UGA",numeric="800",name="Uganda"}, ["UM"] = {alpha3="UMI",numeric="581",name="United States Minor Outlying Islands"}, ["US"] = {alpha3="USA",numeric="840",name="United States",isoname="United States of America",altnames={"US","USA","U.S."}}, ["UY"] = {alpha3="URY",numeric="858",name="Uruguay"}, ["UZ"] = {alpha3="UZB",numeric="860",name="Uzbekistan"}, ["VA"] = {alpha3="VAT",numeric="336",name="Vatican City",isoname="Holy See",altnames={"Holy See (Vatican City State)","Vatican City State"}}, ["VC"] = {alpha3="VCT",numeric="670",name="Saint Vincent and the Grenadines",altnames={"St Vincent and the Grenadines"}}, ["VE"] = {alpha3="VEN",numeric="862",name="Venezuela",isoname="Venezuela (Bolivarian Republic of)"}, ["VG"] = {alpha3="VGB",numeric="092",name="British Virgin Islands",isoname="Virgin Islands (British)",altnames={"UK Virgin Islands","BVI"}}, ["VI"] = {alpha3="VIR",numeric="850",name="United States Virgin Islands",isoname="Virgin Islands (U.S.)",altnames={"US Virgin Islands","USVI"}}, ["VN"] = {alpha3="VNM",numeric="704",name="Vietnam",isoname="Viet Nam"}, ["VU"] = {alpha3="VUT",numeric="548",name="Vanuatu"}, ["WF"] = {alpha3="WLF",numeric="876",name="Wallis and Futuna"}, ["WS"] = {alpha3="WSM",numeric="882",name="Samoa"}, ["YE"] = {alpha3="YEM",numeric="887",name="Yemen"}, ["YT"] = {alpha3="MYT",numeric="175",name="Mayotte"}, ["ZA"] = {alpha3="ZAF",numeric="710",name="South Africa"}, ["ZM"] = {alpha3="ZMB",numeric="894",name="Zambia"}, ["ZW"] = {alpha3="ZWE",numeric="716",name="Zimbabwe"} } 1ae753fe1fa53ce062b0a008dbc9778d589666f0 Module:Location map/styles.css 828 47 72 2023-12-17T17:12:13Z BaiatArbore 2 Created page with "/* {{pp|small=yes}} */ .locmap .od { position: absolute; } .locmap .id { position: absolute; line-height: 0; } .locmap .l0 { font-size: 0; position: absolute; } .locmap .pv { line-height: 110%; position: absolute; text-align: center; } .locmap .pl { line-height: 110%; position: absolute; top: -0.75em; text-align: right; } .locmap .pr { line-height: 110%; position: absolute; top: -0.75em; text-align: left; } .locmap .pv > div { display: inline; pad..." sanitized-css text/css /* {{pp|small=yes}} */ .locmap .od { position: absolute; } .locmap .id { position: absolute; line-height: 0; } .locmap .l0 { font-size: 0; position: absolute; } .locmap .pv { line-height: 110%; position: absolute; text-align: center; } .locmap .pl { line-height: 110%; position: absolute; top: -0.75em; text-align: right; } .locmap .pr { line-height: 110%; position: absolute; top: -0.75em; text-align: left; } .locmap .pv > div { display: inline; padding: 1px; } .locmap .pl > div { display: inline; /* inline does not impact floated elements */ padding: 1px; float: right; } .locmap .pr > div { display: inline; /* inline does not impact floated elements */ padding: 1px; float: left; } 1af8c3b5ae1ff654548b74f76b5208f6b360c5a1 MediaWiki:Common.css 8 48 73 2023-12-17T17:16:05Z BaiatArbore 2 Created page with "/* * This is the CSS common to all desktop skins on en.Wikipedia. * Styling inside .mw-parser-output should generally use TemplateStyles. */ /* Reset italic styling set by user agent */ cite, dfn { font-style: inherit; } /* Straight quote marks for <q> */ q { quotes: '"' '"' "'" "'"; } /* Avoid collision of blockquote with floating elements by swapping margin and padding */ blockquote { overflow: hidden; margin: 1em 0; padding: 0 40px; } /* Consistent size for..." css text/css /* * This is the CSS common to all desktop skins on en.Wikipedia. * Styling inside .mw-parser-output should generally use TemplateStyles. */ /* Reset italic styling set by user agent */ cite, dfn { font-style: inherit; } /* Straight quote marks for <q> */ q { quotes: '"' '"' "'" "'"; } /* Avoid collision of blockquote with floating elements by swapping margin and padding */ blockquote { overflow: hidden; margin: 1em 0; padding: 0 40px; } /* Consistent size for <small>, <sub> and <sup> */ small { font-size: 85%; } .mw-body-content sub, .mw-body-content sup { font-size: 80%; } /* Same spacing for indented and unindented paragraphs on talk pages */ .ns-talk .mw-body-content dd { margin-top: 0.4em; margin-bottom: 0.4em; } /* Reduce page jumps by hiding collapsed/dismissed content */ .client-js .collapsible:not( .mw-made-collapsible).collapsed > tbody > tr:not(:first-child), /* Avoid FOUC/reflows on collapsed elements. */ /* This copies MediaWiki's solution for T42812 to apply to innercollapse/outercollapse (T325115). */ /* TODO: Use :is() selector at some reasonable future when support is good for Most Clients */ /* Reference: https://gerrit.wikimedia.org/g/mediawiki/core/+/ecda06cb2aef55b77c4b4d7ecda492d634419ead/resources/src/jquery/jquery.makeCollapsible.styles.less#75 */ .client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > p, .client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > table, .client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) > thead + tbody, .client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) tr:not( :first-child ), .client-js .outercollapse .innercollapse.mw-collapsible:not( .mw-made-collapsible ) .mw-collapsible-content, /* Hide charinsert base for those not using the gadget */ #editpage-specialchars { display: none; } /* Make the list of references smaller * Keep in sync with Template:Refbegin/styles.css * And Template:Reflist/styles.css */ ol.references { font-size: 90%; margin-bottom: 0.5em; } /* Cite customizations for Parsoid * Once everything uses the one true parser these are just customizations */ span[ rel="mw:referencedBy" ] { counter-reset: mw-ref-linkback 0; } span[ rel='mw:referencedBy' ] > a::before { content: counter( mw-ref-linkback, lower-alpha ); font-size: 80%; font-weight: bold; font-style: italic; } a[ rel="mw:referencedBy" ]::before { font-weight: bold; content: "^"; } span[ rel="mw:referencedBy" ]::before { content: "^ "; } .mw-ref > a[data-mw-group=lower-alpha]::after { content: '[' counter( mw-Ref, lower-alpha ) ']'; } .mw-ref > a[data-mw-group=upper-alpha]::after { content: '[' counter( mw-Ref, upper-alpha ) ']'; } .mw-ref > a[data-mw-group=decimal]::after { content: '[' counter( mw-Ref, decimal ) ']'; } .mw-ref > a[data-mw-group=lower-roman]::after { content: '[' counter( mw-Ref, lower-roman ) ']'; } .mw-ref > a[data-mw-group=upper-roman]::after { content: '[' counter( mw-Ref, upper-roman ) ']'; } .mw-ref > a[data-mw-group=lower-greek]::after { content: '[' counter( mw-Ref, lower-greek ) ']'; } /* Styling for jQuery makeCollapsible, matching that of collapseButton */ .mw-parser-output .mw-collapsible-toggle:not(.mw-ui-button) { font-weight: normal; padding-right: 0.2em; padding-left: 0.2em; } .mw-collapsible-leftside-toggle .mw-collapsible-toggle { /* @noflip */ float: left; } /* Lists in wikitable data cells are always left-aligned */ .wikitable td ul, .wikitable td ol, .wikitable td dl { /* @noflip */ text-align: left; } /* Change the external link icon to a PDF icon for all PDF files */ .mw-parser-output a[href$=".pdf"].external, .mw-parser-output a[href*=".pdf?"].external, .mw-parser-output a[href*=".pdf#"].external, .mw-parser-output a[href$=".PDF"].external, .mw-parser-output a[href*=".PDF?"].external, .mw-parser-output a[href*=".PDF#"].external { background: url("//upload.wikimedia.org/wikipedia/commons/4/4d/Icon_pdf_file.png") no-repeat right; /* @noflip */ padding: 8px 18px 8px 0; } /* System messages styled similarly to fmbox */ /* for .mw-warning-with-logexcerpt, behavior of this line differs between * the edit-protected notice and the special:Contribs for blocked users * The latter has specificity of 3 classes so we have to triple up here. */ .mw-warning-with-logexcerpt.mw-warning-with-logexcerpt.mw-warning-with-logexcerpt, div.mw-lag-warn-high, div.mw-cascadeprotectedwarning, div#mw-protect-cascadeon { clear: both; margin: 0.2em 0; border: 1px solid #bb7070; background-color: #ffdbdb; padding: 0.25em 0.9em; box-sizing: border-box; } /* default colors for partial block message */ /* gotta get over the hump introduced by the triple class above */ .mw-contributions-blocked-notice-partial .mw-warning-with-logexcerpt.mw-warning-with-logexcerpt { border-color: #fc3; background-color: #fef6e7; } /* Minimum thumb width */ figure[typeof~='mw:File/Thumb'], figure[typeof~='mw:File/Frame'], .thumbinner { min-width: 100px; } /* Prevent floating boxes from overlapping any category listings, file histories, edit previews, and edit [Show changes] views. */ #mw-subcategories, #mw-pages, #mw-category-media, #filehistory, #wikiPreview, #wikiDiff { clear: both; } /* Styling for tags in changes pages */ .mw-tag-markers { font-style: italic; font-size: 90%; } /* Hide stuff meant for accounts with special permissions. Made visible again in [[MediaWiki:Group-checkuser.css]], [[MediaWiki:Group-sysop.css]], [[MediaWiki:Group-abusefilter.css]], [[MediaWiki:Group-abusefilter-helper.css]], [[MediaWiki:Group-patroller.css]], [[MediaWiki:Group-templateeditor.css]], [[MediaWiki:Group-extendedmover.css]], [[MediaWiki:Group-extendedconfirmed.css]], and [[Mediawiki:Group-autoconfirmed.css]]. */ .checkuser-show, .sysop-show, .abusefilter-show, .abusefilter-helper-show, .patroller-show, .templateeditor-show, .extendedmover-show, .extendedconfirmed-show, .autoconfirmed-show, .user-show { display: none; } /* Hide the redlink generated by {{Editnotice}}, this overrides the ".sysop-show { display: none; }" above that applies to the same link as well. See [[phab:T45013]] Hide the images in editnotices to keep them readable in VE view. Long term, editnotices should become a core feature so that they can be designed responsive. */ .ve-ui-mwNoticesPopupTool-item .editnotice-redlink, .ve-ui-mwNoticesPopupTool-item .mbox-image, .ve-ui-mwNoticesPopupTool-item .mbox-imageright { display: none !important; } /* Remove bullets when there are multiple edit page warnings */ ul.permissions-errors { margin: 0; } ul.permissions-errors > li { list-style: none; } /* larger inline math */ span.mwe-math-mathml-inline { font-size: 118%; } /* Make <math display="block"> be left aligned with one space indent for * compatibility with style conventions */ .mwe-math-fallback-image-display, .mwe-math-mathml-display { margin-left: 1.6em !important; margin-top: 0.6em; margin-bottom: 0.6em; } .mwe-math-mathml-display math { display: inline; } @media screen { /* Put a chequered background behind images, only visible if they have transparency, * except on main, user, and portal namespaces */ body:not(.ns-0):not(.ns-2):not(.ns-100) .gallerybox .thumb img { background: #fff url(//upload.wikimedia.org/wikipedia/commons/5/5d/Checker-16x16.png) repeat; } /* Display "From Wikipedia, the free encyclopedia" in skins that support it, do not apply to print mode */ #siteSub { display: block; } } /* Hide FlaggedRevs notice UI when there are no pending changes */ .flaggedrevs_draft_synced, .flaggedrevs_stable_synced, /* "Temporary" to remove links in sidebar T255381 */ #t-upload, /* Hide broken download box on Special:Book pending T285400 */ .mw-special-Book #coll-downloadbox { display: none; } /* * BELOW HERE THERE BE SOONTOBE TEMPLATESTYLES THINGS; * SEE [[MediaWiki talk:Common.css/to do]] */ /* Infobox template style */ .infobox { border: 1px solid #a2a9b1; border-spacing: 3px; background-color: #f8f9fa; color: black; /* @noflip */ margin: 0.5em 0 0.5em 1em; padding: 0.2em; /* @noflip */ float: right; /* @noflip */ clear: right; font-size: 88%; line-height: 1.5em; width: 22em; } .infobox-header, .infobox-label, .infobox-above, .infobox-full-data, .infobox-data, .infobox-below, .infobox-subheader, .infobox-image, .infobox-navbar, /* Remove element selector when every .infobox thing is using the standard module/templates */ .infobox th, .infobox td { vertical-align: top; } .infobox-label, .infobox-data, /* Remove element selector when every .infobox thing is using the standard module/templates */ .infobox th, .infobox td { /* @noflip */ text-align: left; } /* Remove .infobox when element selectors above are removed */ .infobox .infobox-above, .infobox .infobox-title, /* Remove element selector when every .infobox thing is using the standard module/templates */ .infobox caption { font-size: 125%; font-weight: bold; text-align: center; } .infobox-title, /* Remove element selector when every .infobox thing is using the standard module/templates */ .infobox caption { padding: 0.2em; } /* Remove .infobox when element selectors above are removed */ .infobox .infobox-header, .infobox .infobox-subheader, .infobox .infobox-image, .infobox .infobox-full-data, .infobox .infobox-below { text-align: center; } /* Remove .infobox when element selectors above are removed */ .infobox .infobox-navbar { /* @noflip */ text-align: right; } /* Normal font styling for wikitable row headers with scope="row" tag */ .wikitable.plainrowheaders th[scope=row], .wikitable.plainrowheaders th[scope=rowgroup] { font-weight: normal; /* @noflip */ text-align: left; } /* Remove underlines from certain links */ .nounderlines a, .IPA a:link, .IPA a:visited { text-decoration: none !important; } /* Prevent line breaks in silly places where desired (nowrap) and links when we don't want them to (nowraplinks a) */ .nowrap, .nowraplinks a { white-space: nowrap; } /* But allow wrapping where desired: */ .wrap, .wraplinks a { white-space: normal; } /* texhtml class for inline math (based on generic times-serif class) */ span.texhtml { font-family: "Nimbus Roman No9 L", "Times New Roman", Times, serif; font-size: 118%; line-height: 1; white-space: nowrap; /* Force tabular and lining display for texhtml */ font-variant-numeric: lining-nums tabular-nums; font-kerning: none; } span.texhtml span.texhtml { font-size: 100%; } @media screen { .nochecker .gallerybox .thumb img { background-image: none; } } /* Put anything you mean to be a sitewide addition above the TemplateStyles * comment above. */ 6fb8f3b49a11a996e92a6014fa1eb15459a6daa4 Template:Fix comma category 10 49 74 2023-12-17T17:17:28Z BaiatArbore 2 Created page with "{{#invoke:String|replace|{{{1}}}|%[%[Category:(.-)from (.-) 2,(.-)%]%]|[[Category:%1 from %2 2%3]]|plain=false}}<noinclude>{{documentation}}</noinclude>" wikitext text/x-wiki {{#invoke:String|replace|{{{1}}}|%[%[Category:(.-)from (.-) 2,(.-)%]%]|[[Category:%1 from %2 2%3]]|plain=false}}<noinclude>{{documentation}}</noinclude> beac35ea2acb0b21dc3e27cb7807f3a10bbb7948 Module:Text 828 50 75 2023-12-17T17:18:29Z BaiatArbore 2 Created page with "local yesNo = require("Module:Yesno") local Text = { serial = "2022-07-21", suite = "Text" } --[=[ Text utilities ]=] -- local globals local PatternCJK = false local PatternCombined = false local PatternLatin = false local PatternTerminated = false local QuoteLang = false local QuoteType = false local RangesLatin = false local SeekQuote = false local function initLatinData() if not RangesLatin then..." Scribunto text/plain local yesNo = require("Module:Yesno") local Text = { serial = "2022-07-21", suite = "Text" } --[=[ Text utilities ]=] -- local globals local PatternCJK = false local PatternCombined = false local PatternLatin = false local PatternTerminated = false local QuoteLang = false local QuoteType = false local RangesLatin = false local SeekQuote = false local function initLatinData() if not RangesLatin then RangesLatin = { { 7, 687 }, { 7531, 7578 }, { 7680, 7935 }, { 8194, 8250 } } end if not PatternLatin then local range PatternLatin = "^[" for i = 1, #RangesLatin do range = RangesLatin[ i ] PatternLatin = PatternLatin .. mw.ustring.char( range[ 1 ], 45, range[ 2 ] ) end -- for i PatternLatin = PatternLatin .. "]*$" end end local function initQuoteData() -- Create quote definitions if not QuoteLang then QuoteLang = { af = "bd", ar = "la", be = "labd", bg = "bd", ca = "la", cs = "bd", da = "bd", de = "bd", dsb = "bd", et = "bd", el = "lald", en = "ld", es = "la", eu = "la", -- fa = "la", fi = "rd", fr = "laSPC", ga = "ld", he = "ldla", hr = "bd", hsb = "bd", hu = "bd", hy = "labd", id = "rd", is = "bd", it = "ld", ja = "x300C", ka = "bd", ko = "ld", lt = "bd", lv = "bd", nl = "ld", nn = "la", no = "la", pl = "bdla", pt = "lald", ro = "bdla", ru = "labd", sk = "bd", sl = "bd", sq = "la", sr = "bx", sv = "rd", th = "ld", tr = "ld", uk = "la", zh = "ld", ["de-ch"] = "la", ["en-gb"] = "lsld", ["en-us"] = "ld", ["fr-ch"] = "la", ["it-ch"] = "la", ["pt-br"] = "ldla", ["zh-tw"] = "x300C", ["zh-cn"] = "ld" } end if not QuoteType then QuoteType = { bd = { { 8222, 8220 }, { 8218, 8217 } }, bdla = { { 8222, 8220 }, { 171, 187 } }, bx = { { 8222, 8221 }, { 8218, 8217 } }, la = { { 171, 187 }, { 8249, 8250 } }, laSPC = { { 171, 187 }, { 8249, 8250 }, true }, labd = { { 171, 187 }, { 8222, 8220 } }, lald = { { 171, 187 }, { 8220, 8221 } }, ld = { { 8220, 8221 }, { 8216, 8217 } }, ldla = { { 8220, 8221 }, { 171, 187 } }, lsld = { { 8216, 8217 }, { 8220, 8221 } }, rd = { { 8221, 8221 }, { 8217, 8217 } }, x300C = { { 0x300C, 0x300D }, { 0x300E, 0x300F } } } end end -- initQuoteData() local function fiatQuote( apply, alien, advance ) -- Quote text -- Parameter: -- apply -- string, with text -- alien -- string, with language code -- advance -- number, with level 1 or 2 local r = apply and tostring(apply) or "" alien = alien or "en" advance = tonumber(advance) or 0 local suite initQuoteData() local slang = alien:match( "^(%l+)-" ) suite = QuoteLang[alien] or slang and QuoteLang[slang] or QuoteLang["en"] if suite then local quotes = QuoteType[ suite ] if quotes then local space if quotes[ 3 ] then space = "&#160;" else space = "" end quotes = quotes[ advance ] if quotes then r = mw.ustring.format( "%s%s%s%s%s", mw.ustring.char( quotes[ 1 ] ), space, apply, space, mw.ustring.char( quotes[ 2 ] ) ) end else mw.log( "fiatQuote() " .. suite ) end end return r end -- fiatQuote() Text.char = function ( apply, again, accept ) -- Create string from codepoints -- Parameter: -- apply -- table (sequence) with numerical codepoints, or nil -- again -- number of repetitions, or nil -- accept -- true, if no error messages to be appended -- Returns: string local r = "" apply = type(apply) == "table" and apply or {} again = math.floor(tonumber(again) or 1) if again < 1 then return "" end local bad = { } local codes = { } for _, v in ipairs( apply ) do local n = tonumber(v) if not n or (n < 32 and n ~= 9 and n ~= 10) then table.insert(bad, tostring(v)) else table.insert(codes, math.floor(n)) end end if #bad > 0 then if not accept then r = tostring( mw.html.create( "span" ) :addClass( "error" ) :wikitext( "bad codepoints: " .. table.concat( bad, " " )) ) end return r end if #codes > 0 then r = mw.ustring.char( unpack( codes ) ) if again > 1 then r = r:rep(again) end end return r end -- Text.char() local function trimAndFormat(args, fmt) local result = {} if type(args) ~= 'table' then args = {args} end for _, v in ipairs(args) do v = mw.text.trim(tostring(v)) if v ~= "" then table.insert(result,fmt and mw.ustring.format(fmt, v) or v) end end return result end Text.concatParams = function ( args, apply, adapt ) -- Concat list items into one string -- Parameter: -- args -- table (sequence) with numKey=string -- apply -- string (optional); separator (default: "|") -- adapt -- string (optional); format including "%s" -- Returns: string local collect = { } return table.concat(trimAndFormat(args,adapt), apply or "|") end -- Text.concatParams() Text.containsCJK = function ( s ) -- Is any CJK code within? -- Parameter: -- s -- string -- Returns: true, if CJK detected s = s and tostring(s) or "" if not patternCJK then patternCJK = mw.ustring.char( 91, 4352, 45, 4607, 11904, 45, 42191, 43072, 45, 43135, 44032, 45, 55215, 63744, 45, 64255, 65072, 45, 65103, 65381, 45, 65500, 131072, 45, 196607, 93 ) end return mw.ustring.find( s, patternCJK ) ~= nil end -- Text.containsCJK() Text.removeDelimited = function (s, prefix, suffix) -- Remove all text in s delimited by prefix and suffix (inclusive) -- Arguments: -- s = string to process -- prefix = initial delimiter -- suffix = ending delimiter -- Returns: stripped string s = s and tostring(s) or "" prefix = prefix and tostring(prefix) or "" suffix = suffix and tostring(suffix) or "" local prefixLen = mw.ustring.len(prefix) local suffixLen = mw.ustring.len(suffix) if prefixLen == 0 or suffixLen == 0 then return s end local i = s:find(prefix, 1, true) local r = s local j while i do j = r:find(suffix, i + prefixLen) if j then r = r:sub(1, i - 1)..r:sub(j+suffixLen) else r = r:sub(1, i - 1) end i = r:find(prefix, 1, true) end return r end Text.getPlain = function ( adjust ) -- Remove wikisyntax from string, except templates -- Parameter: -- adjust -- string -- Returns: string local r = Text.removeDelimited(adjust,"<!--","-->") r = r:gsub( "(</?%l[^>]*>)", "" ) :gsub( "'''", "" ) :gsub( "''", "" ) :gsub( "&nbsp;", " " ) return r end -- Text.getPlain() Text.isLatinRange = function (s) -- Are characters expected to be latin or symbols within latin texts? -- Arguments: -- s = string to analyze -- Returns: true, if valid for latin only s = s and tostring(s) or "" --- ensure input is always string initLatinData() return mw.ustring.match(s, PatternLatin) ~= nil end -- Text.isLatinRange() Text.isQuote = function ( s ) -- Is this character any quotation mark? -- Parameter: -- s = single character to analyze -- Returns: true, if s is quotation mark s = s and tostring(s) or "" if s == "" then return false end if not SeekQuote then SeekQuote = mw.ustring.char( 34, -- " 39, -- ' 171, -- laquo 187, -- raquo 8216, -- lsquo 8217, -- rsquo 8218, -- sbquo 8220, -- ldquo 8221, -- rdquo 8222, -- bdquo 8249, -- lsaquo 8250, -- rsaquo 0x300C, -- CJK 0x300D, -- CJK 0x300E, -- CJK 0x300F ) -- CJK end return mw.ustring.find( SeekQuote, s, 1, true ) ~= nil end -- Text.isQuote() Text.listToText = function ( args, adapt ) -- Format list items similar to mw.text.listToText() -- Parameter: -- args -- table (sequence) with numKey=string -- adapt -- string (optional); format including "%s" -- Returns: string return mw.text.listToText(trimAndFormat(args, adapt)) end -- Text.listToText() Text.quote = function ( apply, alien, advance ) -- Quote text -- Parameter: -- apply -- string, with text -- alien -- string, with language code, or nil -- advance -- number, with level 1 or 2, or nil -- Returns: quoted string apply = apply and tostring(apply) or "" local mode, slang if type( alien ) == "string" then slang = mw.text.trim( alien ):lower() else slang = mw.title.getCurrentTitle().pageLanguage if not slang then -- TODO FIXME: Introduction expected 2017-04 slang = mw.language.getContentLanguage():getCode() end end if advance == 2 then mode = 2 else mode = 1 end return fiatQuote( mw.text.trim( apply ), slang, mode ) end -- Text.quote() Text.quoteUnquoted = function ( apply, alien, advance ) -- Quote text, if not yet quoted and not empty -- Parameter: -- apply -- string, with text -- alien -- string, with language code, or nil -- advance -- number, with level 1 or 2, or nil -- Returns: string; possibly quoted local r = mw.text.trim( apply and tostring(apply) or "" ) local s = mw.ustring.sub( r, 1, 1 ) if s ~= "" and not Text.isQuote( s, advance ) then s = mw.ustring.sub( r, -1, 1 ) if not Text.isQuote( s ) then r = Text.quote( r, alien, advance ) end end return r end -- Text.quoteUnquoted() Text.removeDiacritics = function ( adjust ) -- Remove all diacritics -- Parameter: -- adjust -- string -- Returns: string; all latin letters should be ASCII -- or basic greek or cyrillic or symbols etc. local cleanup, decomposed if not PatternCombined then PatternCombined = mw.ustring.char( 91, 0x0300, 45, 0x036F, 0x1AB0, 45, 0x1AFF, 0x1DC0, 45, 0x1DFF, 0xFE20, 45, 0xFE2F, 93 ) end decomposed = mw.ustring.toNFD( adjust and tostring(adjust) or "" ) cleanup = mw.ustring.gsub( decomposed, PatternCombined, "" ) return mw.ustring.toNFC( cleanup ) end -- Text.removeDiacritics() Text.sentenceTerminated = function ( analyse ) -- Is string terminated by dot, question or exclamation mark? -- Quotation, link termination and so on granted -- Parameter: -- analyse -- string -- Returns: true, if sentence terminated local r if not PatternTerminated then PatternTerminated = mw.ustring.char( 91, 12290, 65281, 65294, 65311 ) .. "!%.%?…][\"'%]‹›«»‘’“”]*$" end if mw.ustring.find( analyse, PatternTerminated ) then r = true else r = false end return r end -- Text.sentenceTerminated() Text.ucfirstAll = function ( adjust) -- Capitalize all words -- Arguments: -- adjust = string to adjust -- Returns: string with all first letters in upper case adjust = adjust and tostring(adjust) or "" local r = mw.text.decode(adjust,true) local i = 1 local c, j, m m = (r ~= adjust) r = " "..r while i do i = mw.ustring.find( r, "%W%l", i ) if i then j = i + 1 c = mw.ustring.upper( mw.ustring.sub( r, j, j ) ) r = string.format( "%s%s%s", mw.ustring.sub( r, 1, i ), c, mw.ustring.sub( r, i + 2 ) ) i = j end end -- while i r = r:sub( 2 ) if m then r = mw.text.encode(r) end return r end -- Text.ucfirstAll() Text.uprightNonlatin = function ( adjust ) -- Ensure non-italics for non-latin text parts -- One single greek letter might be granted -- Precondition: -- adjust -- string -- Returns: string with non-latin parts enclosed in <span> local r initLatinData() if mw.ustring.match( adjust, PatternLatin ) then -- latin only, horizontal dashes, quotes r = adjust else local c local j = false local k = 1 local m = false local n = mw.ustring.len( adjust ) local span = "%s%s<span dir='auto' style='font-style:normal'>%s</span>" local flat = function ( a ) -- isLatin local range for i = 1, #RangesLatin do range = RangesLatin[ i ] if a >= range[ 1 ] and a <= range[ 2 ] then return true end end -- for i end -- flat() local focus = function ( a ) -- char is not ambivalent local r = ( a > 64 ) if r then r = ( a < 8192 or a > 8212 ) else r = ( a == 38 or a == 60 ) -- '&' '<' end return r end -- focus() local form = function ( a ) return string.format( span, r, mw.ustring.sub( adjust, k, j - 1 ), mw.ustring.sub( adjust, j, a ) ) end -- form() r = "" for i = 1, n do c = mw.ustring.codepoint( adjust, i, i ) if focus( c ) then if flat( c ) then if j then if m then if i == m then -- single greek letter. j = false end m = false end if j then local nx = i - 1 local s = "" for ix = nx, 1, -1 do c = mw.ustring.sub( adjust, ix, ix ) if c == " " or c == "(" then nx = nx - 1 s = c .. s else break -- for ix end end -- for ix r = form( nx ) .. s j = false k = i end end elseif not j then j = i if c >= 880 and c <= 1023 then -- single greek letter? m = i + 1 else m = false end end elseif m then m = m + 1 end end -- for i if j and ( not m or m < n ) then r = form( n ) else r = r .. mw.ustring.sub( adjust, k ) end end return r end -- Text.uprightNonlatin() Text.test = function ( about ) local r if about == "quote" then initQuoteData() r = { } r.QuoteLang = QuoteLang r.QuoteType = QuoteType end return r end -- Text.test() -- Export local p = { } for _, func in ipairs({'containsCJK','isLatinRange','isQuote','sentenceTerminated'}) do p[func] = function (frame) return Text[func]( frame.args[ 1 ] or "" ) and "1" or "" end end for _, func in ipairs({'getPlain','removeDiacritics','ucfirstAll','uprightNonlatin'}) do p[func] = function (frame) return Text[func]( frame.args[ 1 ] or "" ) end end function p.char( frame ) local params = frame:getParent().args local story = params[ 1 ] local codes, lenient, multiple if not story then params = frame.args story = params[ 1 ] end if story then local items = mw.text.split( mw.text.trim(story), "%s+" ) if #items > 0 then local j lenient = (yesNo(params.errors) == false) codes = { } multiple = tonumber( params[ "*" ] ) for _, v in ipairs( items ) do j = tonumber((v:sub( 1, 1 ) == "x" and "0" or "") .. v) table.insert( codes, j or v ) end end end return Text.char( codes, multiple, lenient ) end function p.concatParams( frame ) local args local template = frame.args.template if type( template ) == "string" then template = mw.text.trim( template ) template = ( template == "1" ) end if template then args = frame:getParent().args else args = frame.args end return Text.concatParams( args, frame.args.separator, frame.args.format ) end function p.listToFormat(frame) local lists = {} local pformat = frame.args["format"] local sep = frame.args["sep"] or ";" -- Parameter parsen: Listen for k, v in pairs(frame.args) do local knum = tonumber(k) if knum then lists[knum] = v end end -- Listen splitten local maxListLen = 0 for i = 1, #lists do lists[i] = mw.text.split(lists[i], sep) if #lists[i] > maxListLen then maxListLen = #lists[i] end end -- Ergebnisstring generieren local result = "" local result_line = "" for i = 1, maxListLen do result_line = pformat for j = 1, #lists do result_line = mw.ustring.gsub(result_line, "%%s", lists[j][i], 1) end result = result .. result_line end return result end function p.listToText( frame ) local args local template = frame.args.template if type( template ) == "string" then template = mw.text.trim( template ) template = ( template == "1" ) end if template then args = frame:getParent().args else args = frame.args end return Text.listToText( args, frame.args.format ) end function p.quote( frame ) local slang = frame.args[2] if type( slang ) == "string" then slang = mw.text.trim( slang ) if slang == "" then slang = false end end return Text.quote( frame.args[ 1 ] or "", slang, tonumber( frame.args[3] ) ) end function p.quoteUnquoted( frame ) local slang = frame.args[2] if type( slang ) == "string" then slang = mw.text.trim( slang ) if slang == "" then slang = false end end return Text.quoteUnquoted( frame.args[ 1 ] or "", slang, tonumber( frame.args[3] ) ) end function p.zip(frame) local lists = {} local seps = {} local defaultsep = frame.args["sep"] or "" local innersep = frame.args["isep"] or "" local outersep = frame.args["osep"] or "" -- Parameter parsen for k, v in pairs(frame.args) do local knum = tonumber(k) if knum then lists[knum] = v else if string.sub(k, 1, 3) == "sep" then local sepnum = tonumber(string.sub(k, 4)) if sepnum then seps[sepnum] = v end end end end -- sofern keine expliziten Separatoren angegeben sind, den Standardseparator verwenden for i = 1, math.max(#seps, #lists) do if not seps[i] then seps[i] = defaultsep end end -- Listen splitten local maxListLen = 0 for i = 1, #lists do lists[i] = mw.text.split(lists[i], seps[i]) if #lists[i] > maxListLen then maxListLen = #lists[i] end end local result = "" for i = 1, maxListLen do if i ~= 1 then result = result .. outersep end for j = 1, #lists do if j ~= 1 then result = result .. innersep end result = result .. (lists[j][i] or "") end end return result end function p.failsafe() return Text.serial end p.Text = function () return Text end -- p.Text return p 07f1fc4d39342fd92bdae1c5463bbfede7eeda1a Module:Detect singular 828 51 76 2023-12-17T17:19:06Z BaiatArbore 2 Created page with "local p = {} local getArgs = require('Module:Arguments').getArgs local yesNo = require('Module:Yesno') local getPlain = require('Module:Text').Text().getPlain -- function to determine whether "sub" occurs in "s" local function plainFind(s, sub) return mw.ustring.find(s, sub, 1, true) end -- function to count the number of times "pattern" (a regex) occurs in "s" local function countMatches(s, pattern) local _, count = mw.ustring.gsub(s, pattern, '') return count end..." Scribunto text/plain local p = {} local getArgs = require('Module:Arguments').getArgs local yesNo = require('Module:Yesno') local getPlain = require('Module:Text').Text().getPlain -- function to determine whether "sub" occurs in "s" local function plainFind(s, sub) return mw.ustring.find(s, sub, 1, true) end -- function to count the number of times "pattern" (a regex) occurs in "s" local function countMatches(s, pattern) local _, count = mw.ustring.gsub(s, pattern, '') return count end local singular = 1 local likelyPlural = 2 local plural = 3 -- Determine whether a string is singular or plural (i.e., it represents one -- item or many) -- Arguments: -- origArgs[1]: string to process -- origArgs.no_comma: if false, use commas to detect plural (default false) -- origArgs.parse_links: if false, treat wikilinks as opaque singular objects (default false) -- Returns: -- singular, likelyPlural, or plural (see constants above), or nil for completely unknown function p._main(origArgs) origArgs = type(origArgs) == 'table' and origArgs or {} local args = {} -- canonicalize boolean arguments for key, default in pairs({no_comma=false,parse_links=false,any_comma=false,no_and=false}) do if origArgs[key] == nil then args[key] = default else args[key] = yesNo(origArgs[key],default) end end local checkComma = not args.no_comma local checkAnd = not args.no_and local rewriteLinks = not args.parse_links local anyComma = args.any_comma local s = origArgs[1] -- the input string if not s then return nil -- empty input returns nil end s = tostring(s) s = mw.text.decode(s,true) --- replace HTML entities (to avoid spurious semicolons) if plainFind(s,'data-plural="0"') then -- magic data string to return true return singular end if plainFind(s,'data-plural="1"') then -- magic data string to return false return plural end -- count number of list items local numListItems = countMatches(s,'<%s*li') -- if exactly one, then singular, if more than one, then plural if numListItems == 1 then return singular end if numListItems > 1 then return plural end -- if "list of" occurs inside of wlink, then it's plural if mw.ustring.find(s:lower(), '%[%[[^%]]*list of[^%]]+%]%]') then return plural end -- fix for trailing br tags passed through [[template:marriage]] s = mw.ustring.gsub(s, '<%s*br[^>]*>%s*(</div>)', '%1') -- replace all wikilinks with fixed string if rewriteLinks then s = mw.ustring.gsub(s,'%b[]','WIKILINK') end -- Five conditions: any one of them can make the string a likely plural or plural local hasBreak = mw.ustring.find(s,'<%s*br') -- For the last 4, evaluate on string stripped of wikimarkup s = getPlain(s) local hasBullets = countMatches(s,'%*+') > 1 local multipleQids = mw.ustring.find(s,'Q%d+[%p%s]+Q%d+') -- has multiple QIDs in a row if hasBullets or multipleQids then return plural end local commaPattern = anyComma and '[,;]' or '%D[,;]%D' -- semi-colon similar to comma local hasComma = checkComma and mw.ustring.find(s, commaPattern) local hasAnd = checkAnd and mw.ustring.find(s,'[,%s]and%s') if hasBreak or hasComma or hasAnd then return likelyPlural end return singular end function p._pluralize(args) args = type(args) == 'table' and args or {} local singularForm = args[3] or args.singular or "" local pluralForm = args[4] or args.plural or "" local likelyForm = args.likely or pluralForm local link = args[5] or args.link if link then link = tostring(link) singularForm = '[['..link..'|'..singularForm..']]' pluralForm = '[['..link..'|'..pluralForm..']]' likelyForm = '[['..link..'|'..likelyForm..']]' end if args[2] then return pluralForm end local detect = p._main(args) if detect == nil then return "" -- return blank on complete failure end if detect == singular then return singularForm elseif detect == likelyPlural then return likelyForm else return pluralForm end end function p.main(frame) local args = getArgs(frame) -- For template, return 1 if singular, blank if plural or empty local result = p._main(args) if result == nil then return 1 end return result == singular and 1 or "" end function p.pluralize(frame) local args = getArgs(frame) return p._pluralize(args) end return p 6afb2e8c0bd8ddff094e2861b836521ee4a5a779 Template:Pluralize from text 10 52 77 2023-12-17T17:19:23Z BaiatArbore 2 Created page with "{{#invoke:Detect singular|pluralize}}<noinclude>{{documentation}}</noinclude>" wikitext text/x-wiki {{#invoke:Detect singular|pluralize}}<noinclude>{{documentation}}</noinclude> 305f4b531ea5639895c83cecd0fd809f7f5cf845 Template:Template other 10 53 78 2023-12-17T17:20:03Z BaiatArbore 2 Created page with "{{#switch: <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--> | {{#ifeq:{{NAMESPACE}}|{{ns:Template}} | template | other }} }} | template = {{{1|}}} | other | #default = {{{2|}}} }}<!--End switch--><noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>" wikitext text/x-wiki {{#switch: <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--> | {{#ifeq:{{NAMESPACE}}|{{ns:Template}} | template | other }} }} | template = {{{1|}}} | other | #default = {{{2|}}} }}<!--End switch--><noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude> 06fb13d264df967b5232141067eb7d2b67372d76 Module:Pagetype 828 54 79 2023-12-17T17:21:19Z BaiatArbore 2 Created page with "-------------------------------------------------------------------------------- -- -- -- PAGETYPE -- -- -- -- This is a meta-module intended to replace {{pagetype}} and similar -- -- templates. It automatically detects namespaces, and allows for..." Scribunto text/plain -------------------------------------------------------------------------------- -- -- -- PAGETYPE -- -- -- -- This is a meta-module intended to replace {{pagetype}} and similar -- -- templates. It automatically detects namespaces, and allows for a -- -- great deal of customisation. It can easily be ported to other -- -- wikis by changing the values in the [[Module:Pagetype/config]]. -- -- -- -------------------------------------------------------------------------------- -- Load config. local cfg = mw.loadData('Module:Pagetype/config') -- Load required modules. local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno') local mDisambiguation = require('Module:Disambiguation') local p = {} -- Look up a namespace argument in the args table. local function lookUpNamespaceArg(args, key) local arg = args[key] -- Convert "yes", "1" etc. to true, "no", "0" etc. to false, and leave -- other values the same. return yesno(arg, arg) end -- Append multiple values to an array local function appendMultiple(target, source) for _, value in ipairs(source) do table.insert(target, value) end end -- Get argument keys for a title's namespace local function getNamespaceArgKeys(title, cfg) local nsInfo = mw.site.namespaces[title.namespace] local customAliases = cfg.customNamespaceAliases[title.namespace] or {} local keys = {} if nsInfo.name ~= '' then table.insert(keys, nsInfo.name) end if nsInfo.canonicalName ~= nsInfo.name and nsInfo.canonicalName ~= '' then table.insert(keys, nsInfo.canonicalName) end appendMultiple(keys, nsInfo.aliases) appendMultiple(keys, customAliases) return keys end -- Get the argument for a title's namespace, if it was specified in the args -- table. local function getNamespaceArg(title, args, cfg) if title.isTalkPage then return lookUpNamespaceArg(args, cfg.talk) end for _, key in ipairs(getNamespaceArgKeys(title, cfg)) do local arg = lookUpNamespaceArg(args, mw.ustring.lower(key)) if arg ~= nil then return arg end end return nil end -- Look up a page type specific to the title's namespace local function getExplicitPageType(title, cfg) if title.isTalkPage then return cfg.talkDefault else return cfg.pagetypes[title.namespace] end end -- Get a default page type that is not specific to the title's namespace local function getDefaultPageType(args, cfg) local other = lookUpNamespaceArg(args, cfg.other) if type(other) == 'string' then return other else return cfg.otherDefault end end local function detectRedirects(title, args) local redirect = lookUpNamespaceArg(args, cfg.redirect) if redirect == false then -- Don't detect redirects if they have been specifically disallowed. return nil end -- Allow custom values for redirects. if not title.isRedirect then return nil elseif type(redirect) == 'string' then return redirect else return cfg.redirectDefault end end local function detectDisambiguationPages(title, args, cfg) if title.namespace ~= 0 then -- Only detect disambiguation pages in mainspace return nil end local dab = lookUpNamespaceArg(args, cfg.dab) if dab == false then -- Don't detect disambiguation pages if explicitly disallowed return nil end if not mDisambiguation.isDisambiguation(title:getContent()) then return nil elseif type(dab) == 'string' then return dab else return cfg.dabDefault end end -- Gets the pagetype from a class specified from the first positional -- parameter. local function getPageTypeFromClass(args, class, key, aliasTable, default) local arg = lookUpNamespaceArg(args, key) if arg == false then -- Don't check for this class if it is specifically disallowed. return nil end if aliasTable[class] then if type(arg) == 'string' then return arg else return default end end return nil end -- Get page types for mainspaces pages with an explicit class specified local function getMainNamespaceClassPageType(title, args, cfg) if title.namespace ~= 0 then return nil end local class = args[1] if type(class) == 'string' then -- Put in lower case so e.g. "na" and "NA" will both match. class = mw.ustring.lower(class) end return getPageTypeFromClass( args, class, cfg.na, cfg.naAliases, cfg.naDefault ) end -- Get page type specified by an explicit namespace argument. local function getNamespaceArgPageType(title, args, cfg) local namespaceArg = getNamespaceArg(title, args, cfg) if namespaceArg == true then -- Namespace has been explicitly enabled, so return the default for -- this namespace return getExplicitPageType(title, cfg) elseif namespaceArg == false then -- Namespace has been explicitly disabled return getDefaultPageType(args, cfg) elseif namespaceArg then -- This namespaces uses custom text return namespaceArg else return nil end end -- Whether the title is in the set of default active namespaces which are -- looked up in cfg.pagetypes. local function isInDefaultActiveNamespace(title, args, cfg) local defaultNamespacesKey = args[cfg.defaultns] if defaultNamespacesKey == cfg.defaultnsAll then return true end local defaultNamespaces if defaultNamespacesKey == cfg.defaultnsExtended then defaultNamespaces = cfg.extendedNamespaces elseif defaultNamespacesKey == cfg.defaultnsNone then defaultNamespaces = {} else defaultNamespaces = cfg.defaultNamespaces end return defaultNamespaces[title.namespace] or false end -- Get page type not specified or detected by other means local function getOtherPageType(title, args, cfg) if isInDefaultActiveNamespace(title, args, cfg) then return getExplicitPageType(title, cfg) else return getDefaultPageType(args, cfg) end end local function getPageType(title, args, cfg) return ( detectRedirects(title, args, cfg) or detectDisambiguationPages(title, args, cfg) or getMainNamespaceClassPageType(title, args, cfg) or getNamespaceArgPageType(title, args, cfg) or getOtherPageType(title, args, cfg) ) end local function shouldUseSubjectTitle(args, cfg) return not yesno(args.talk, true) and args[cfg.defaultns] ~= cfg.defaultnsAll end -- Get the Scribunto title object to fetch the page type of local function getTitle(args, cfg) local title if args.page then title = mw.title.new(args.page) if not title then return nil end else title = mw.title.getCurrentTitle() end if shouldUseSubjectTitle(args, cfg) then return title.subjectPageTitle else return title end end local function pluralize(pageType, cfg) if cfg.irregularPlurals[pageType] then return cfg.irregularPlurals[pageType] else return pageType .. cfg.plural -- often 's' end end local function capitalize(pageType) local first = mw.ustring.sub(pageType, 1, 1) local rest = mw.ustring.sub(pageType, 2) return mw.ustring.upper(first) .. rest end function p._main(args) local title = getTitle(args, cfg) local pageType = getPageType(title, args, cfg) if yesno(args.plural, false) then pageType = pluralize(pageType, cfg) end if yesno(args.caps, false) then pageType = capitalize(pageType) end return pageType end function p.main(frame) local args = getArgs(frame) return p._main(args) end return p ab72b17cbd3e423817484aedfd33b480e9ba3611 Module:Disambiguation 828 55 80 2023-12-17T17:21:50Z BaiatArbore 2 Created page with "local p = {} local mRedirect = require('Module:Redirect') local disambiguationTemplates = mw.loadData('Module:Disambiguation/templates') local function capitalize(s) -- This function only works on ASCII strings. If your wiki has -- disambiguation templates that use Unicode strings, use the commented-out -- line instead. Enwiki uses ASCII string manipulation only here to improve -- performance. return s:sub(1, 1):upper() .. s:sub(2, -1) -- return mw.ustring.upper(m..." Scribunto text/plain local p = {} local mRedirect = require('Module:Redirect') local disambiguationTemplates = mw.loadData('Module:Disambiguation/templates') local function capitalize(s) -- This function only works on ASCII strings. If your wiki has -- disambiguation templates that use Unicode strings, use the commented-out -- line instead. Enwiki uses ASCII string manipulation only here to improve -- performance. return s:sub(1, 1):upper() .. s:sub(2, -1) -- return mw.ustring.upper(mw.ustring.sub(1, 1)) .. mw.ustring.sub(2, -1) end local function isDisambiguationTemplate(template) return disambiguationTemplates[capitalize(template)] or false end p.isDisambiguation = function(content) -- false if there is no content if content == nil then return false end -- redirects are not disambiguation pages if mRedirect.getTargetFromText(content) ~= nil then return false end -- check for disambiguation templates in the content local templateNames = {} for template in string.gmatch(content, "{{%s*([^|}]-)%s*[|}]") do if isDisambiguationTemplate(template) then return true end end -- check for magic word if string.find(content, "__DISAMBIG__", 1, true) ~= nil then return true end return false end p._isDisambiguationPage = function(page) -- Look "(disambiguation)" in the title if string.find(page, "(disambiguation)",0,true) ~= nil then return true; end -- Look for disamiguation template in page content local title = mw.title.new(page) if not title then return false end local content = title:getContent() return p.isDisambiguation(content) end -- Entry points for templates p.isDisambiguationPage = function(frame) local title = frame.args[1] return p._isDisambiguationPage(title) and "yes" or "" end return p fedda4d3046080cab39fcd65ab9a9318912a8d57 Module:Redirect 828 56 81 2023-12-17T17:23:28Z BaiatArbore 2 Created page with "-- This module provides functions for getting the target of a redirect page. local p = {} -- Gets a mw.title object, using pcall to avoid generating script errors if we -- are over the expensive function count limit (among other possible causes). local function getTitle(...) local success, titleObj = pcall(mw.title.new, ...) if success then return titleObj else return nil end end -- Gets the name of a page that a redirect leads to, or nil if it isn't a -- redi..." Scribunto text/plain -- This module provides functions for getting the target of a redirect page. local p = {} -- Gets a mw.title object, using pcall to avoid generating script errors if we -- are over the expensive function count limit (among other possible causes). local function getTitle(...) local success, titleObj = pcall(mw.title.new, ...) if success then return titleObj else return nil end end -- Gets the name of a page that a redirect leads to, or nil if it isn't a -- redirect. function p.getTargetFromText(text) local target = string.match( text, "^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)%]%]" ) or string.match( text, "^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)|[^%[%]]-%]%]" ) return target and mw.uri.decode(target, 'PATH') end -- Gets the target of a redirect. If the page specified is not a redirect, -- returns nil. function p.getTarget(page, fulltext) -- Get the title object. Both page names and title objects are allowed -- as input. local titleObj if type(page) == 'string' or type(page) == 'number' then titleObj = getTitle(page) elseif type(page) == 'table' and type(page.getContent) == 'function' then titleObj = page else error(string.format( "bad argument #1 to 'getTarget'" .. " (string, number, or title object expected, got %s)", type(page) ), 2) end if not titleObj then return nil end local targetTitle = titleObj.redirectTarget if targetTitle then if fulltext then return targetTitle.fullText else return targetTitle.prefixedText end else return nil end end --[[ -- Given a single page name determines what page it redirects to and returns the -- target page name, or the passed page name when not a redirect. The passed -- page name can be given as plain text or as a page link. -- -- Returns page name as plain text, or when the bracket parameter is given, as a -- page link. Returns an error message when page does not exist or the redirect -- target cannot be determined for some reason. --]] function p.luaMain(rname, bracket, fulltext) if type(rname) ~= "string" or not rname:find("%S") then return nil end bracket = bracket and "[[%s]]" or "%s" rname = rname:match("%[%[(.+)%]%]") or rname local target = p.getTarget(rname, fulltext) local ret = target or rname ret = getTitle(ret) if ret then if fulltext then ret = ret.fullText else ret = ret.prefixedText end return bracket:format(ret) else return nil end end -- Provides access to the luaMain function from wikitext. function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {frameOnly = true}) return p.luaMain(args[1], args.bracket, args.fulltext) or '' end -- Returns true if the specified page is a redirect, and false otherwise. function p.luaIsRedirect(page) local titleObj = getTitle(page) if not titleObj then return false end if titleObj.isRedirect then return true else return false end end -- Provides access to the luaIsRedirect function from wikitext, returning 'yes' -- if the specified page is a redirect, and the blank string otherwise. function p.isRedirect(frame) local args = require('Module:Arguments').getArgs(frame, {frameOnly = true}) if p.luaIsRedirect(args[1]) then return 'yes' else return '' end end return p a224c45940343d66f49a78b0a39b2045e2c45d20 Module:Namespace detect 828 57 82 2023-12-17T17:24:09Z BaiatArbore 2 Created page with "--[[ -------------------------------------------------------------------------------- -- -- -- NAMESPACE DETECT -- -- -- -- This module implements the {{namespace detect}} template in Lua, with a -- -- few improvements: all namespaces and all namespace aliases are..." Scribunto text/plain --[[ -------------------------------------------------------------------------------- -- -- -- NAMESPACE DETECT -- -- -- -- This module implements the {{namespace detect}} template in Lua, with a -- -- few improvements: all namespaces and all namespace aliases are supported, -- -- and namespace names are detected automatically for the local wiki. The -- -- module can also use the corresponding subject namespace value if it is -- -- used on a talk page. Parameter names can be configured for different wikis -- -- by altering the values in the "cfg" table in -- -- Module:Namespace detect/config. -- -- -- -------------------------------------------------------------------------------- --]] local data = mw.loadData('Module:Namespace detect/data') local argKeys = data.argKeys local cfg = data.cfg local mappings = data.mappings local yesno = require('Module:Yesno') local mArguments -- Lazily initialise Module:Arguments local mTableTools -- Lazily initilalise Module:TableTools local ustringLower = mw.ustring.lower local p = {} local function fetchValue(t1, t2) -- Fetches a value from the table t1 for the first key in array t2 where -- a non-nil value of t1 exists. for i, key in ipairs(t2) do local value = t1[key] if value ~= nil then return value end end return nil end local function equalsArrayValue(t, value) -- Returns true if value equals a value in the array t. Otherwise -- returns false. for i, arrayValue in ipairs(t) do if value == arrayValue then return true end end return false end function p.getPageObject(page) -- Get the page object, passing the function through pcall in case of -- errors, e.g. being over the expensive function count limit. if page then local success, pageObject = pcall(mw.title.new, page) if success then return pageObject else return nil end else return mw.title.getCurrentTitle() end end -- Provided for backward compatibility with other modules function p.getParamMappings() return mappings end local function getNamespace(args) -- This function gets the namespace name from the page object. local page = fetchValue(args, argKeys.demopage) if page == '' then page = nil end local demospace = fetchValue(args, argKeys.demospace) if demospace == '' then demospace = nil end local subjectns = fetchValue(args, argKeys.subjectns) local ret if demospace then -- Handle "demospace = main" properly. if equalsArrayValue(argKeys.main, ustringLower(demospace)) then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- Get the subject namespace if the option is set, -- otherwise use "talk". if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = 'talk' end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = ret:gsub('_', ' ') return ustringLower(ret) end function p._main(args) -- Check the parameters stored in the mappings table for any matches. local namespace = getNamespace(args) or 'other' -- "other" avoids nil table keys local params = mappings[namespace] or {} local ret = fetchValue(args, params) --[[ -- If there were no matches, return parameters for other namespaces. -- This happens if there was no text specified for the namespace that -- was detected or if the demospace parameter is not a valid -- namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. --]] if ret == nil then ret = fetchValue(args, argKeys.other) end return ret end function p.main(frame) mArguments = require('Module:Arguments') local args = mArguments.getArgs(frame, {removeBlanks = false}) local ret = p._main(args) return ret or '' end function p.table(frame) --[[ -- Create a wikitable of all subject namespace parameters, for -- documentation purposes. The talk parameter is optional, in case it -- needs to be excluded in the documentation. --]] -- Load modules and initialise variables. mTableTools = require('Module:TableTools') local namespaces = mw.site.namespaces local cfg = data.cfg local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and yesno(frame.args.talk) -- Whether to use the talk parameter. -- Get the header names. local function checkValue(value, default) if type(value) == 'string' then return value else return default end end local nsHeader = checkValue(cfg.wikitableNamespaceHeader, 'Namespace') local aliasesHeader = checkValue(cfg.wikitableAliasesHeader, 'Aliases') -- Put the namespaces in order. local mappingsOrdered = {} for nsname, params in pairs(mappings) do if useTalk or nsname ~= 'talk' then local nsid = namespaces[nsname].id -- Add 1, as the array must start with 1; nsid 0 would be lost otherwise. nsid = nsid + 1 mappingsOrdered[nsid] = params end end mappingsOrdered = mTableTools.compressSparseArray(mappingsOrdered) -- Build the table. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. nsHeader .. '\n! ' .. aliasesHeader for i, params in ipairs(mappingsOrdered) do for j, param in ipairs(params) do if j == 1 then ret = ret .. '\n|-' .. '\n| <code>' .. param .. '</code>' .. '\n| ' elseif j == 2 then ret = ret .. '<code>' .. param .. '</code>' else ret = ret .. ', <code>' .. param .. '</code>' end end end ret = ret .. '\n|-' .. '\n|}' return ret end return p a4757000273064f151f0f22dc0e139092e5ff443 Module:Namespace detect/data 828 58 83 2023-12-17T17:24:43Z BaiatArbore 2 Created page with "-------------------------------------------------------------------------------- -- Namespace detect data -- -- This module holds data for [[Module:Namespace detect]] to be loaded per -- -- page, rather than per #invoke, for performance reasons. -- -------------------------------------------------------------------------------- local cfg = require('Module:Namespace detect/config') local function..." Scribunto text/plain -------------------------------------------------------------------------------- -- Namespace detect data -- -- This module holds data for [[Module:Namespace detect]] to be loaded per -- -- page, rather than per #invoke, for performance reasons. -- -------------------------------------------------------------------------------- local cfg = require('Module:Namespace detect/config') local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end -- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings. local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' } local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end local function getParamMappings() --[[ -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [''] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } --]] local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings() } d224f42a258bc308ef3ad8cc8686cd7a4f47d005 Module:Namespace detect/config 828 59 84 2023-12-17T17:25:10Z BaiatArbore 2 Created page with "-------------------------------------------------------------------------------- -- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- --..." Scribunto text/plain -------------------------------------------------------------------------------- -- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. -- -------------------------------------------------------------------------------- local cfg = {} -- Don't edit this line. -------------------------------------------------------------------------------- -- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} -- -------------------------------------------------------------------------------- ---- This parameter displays content for the main namespace: -- cfg.main = 'main' ---- This parameter displays in talk namespaces: -- cfg.talk = 'talk' ---- This parameter displays content for "other" namespaces (namespaces for which ---- parameters have not been specified): -- cfg.other = 'other' ---- This parameter makes talk pages behave as though they are the corresponding ---- subject namespace. Note that this parameter is used with [[Module:Yesno]]. ---- Edit that module to change the default values of "yes", "no", etc. -- cfg.subjectns = 'subjectns' ---- This parameter sets a demonstration namespace: -- cfg.demospace = 'demospace' ---- This parameter sets a specific page to compare: cfg.demopage = 'page' -------------------------------------------------------------------------------- -- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. -- -------------------------------------------------------------------------------- ---- The header for the namespace column in the wikitable containing the list of ---- possible subject-space parameters. -- cfg.wikitableNamespaceHeader = 'Namespace' ---- The header for the wikitable containing the list of possible subject-space ---- parameters. -- cfg.wikitableAliasesHeader = 'Aliases' -------------------------------------------------------------------------------- -- End of configuration data -- -------------------------------------------------------------------------------- return cfg -- Don't edit this line. 0e4ff08d13c4b664d66b32c232deb129b77c1a56 Module:Pagetype/config 828 60 85 2023-12-17T17:25:40Z BaiatArbore 2 Created page with "-------------------------------------------------------------------------------- -- Module:Pagetype configuration data -- -- This page holds localisation and configuration data for Module:Pagetype. -- -------------------------------------------------------------------------------- local cfg = {} -- Don't edit this line. -------------------------------------------------------------------------------- -- St..." Scribunto text/plain -------------------------------------------------------------------------------- -- Module:Pagetype configuration data -- -- This page holds localisation and configuration data for Module:Pagetype. -- -------------------------------------------------------------------------------- local cfg = {} -- Don't edit this line. -------------------------------------------------------------------------------- -- Start configuration data -- -------------------------------------------------------------------------------- -- This table holds the default page types for each namespace. Keys to this -- table should be integers that can be used as keys to mw.site.namespaces. cfg.pagetypes = { [0] = 'article', -- Main namespace [2] = 'user page', [4] = 'project page', [6] = 'file', [8] = 'interface page', -- MediaWiki namespace [10] = 'template', [12] = 'help page', [14] = 'category', [100] = 'portal', [118] = 'draft', [710] = 'Timed Text page', [828] = 'module', [2300] = 'gadget', [2302] = 'gadget definition', [-1] = 'special page', [-2] = 'file', -- Media namespace } -- This table holds the namespaces to be looked up from cfg.pagetypes by -- default. cfg.defaultNamespaces = { [0] = true, -- main [6] = true, -- file [10] = true, -- template [14] = true, -- category [828] = true, -- module } -- This table holds the namespaces to be looked up from cfg.pagetypes if -- cfg.defaultnsExtended is set. cfg.extendedNamespaces = { [0] = true, -- main [2] = true, -- user [4] = true, -- project [6] = true, -- file [8] = true, -- mediawiki [10] = true, -- template [12] = true, -- help [14] = true, -- category [100] = true, -- portal [118] = true, -- draft [828] = true, -- module } -- This table holds custom aliases for each namespace. cfg.customNamespaceAliases = { [0] = {'main'}, } -- The parameter name to set which default namespace values to be looked up from -- cfg.pagetypes. cfg.defaultns = 'defaultns' -- The value of cfg.defaultns to set all namespaces, including talk. cfg.defaultnsAll = 'all' -- The value of cfg.defaultns to set the namespaces listed in -- cfg.extendedNamespaces cfg.defaultnsExtended = 'extended' -- The value of cfg.defaultns to set no default namespaces. cfg.defaultnsNone = 'none' -- The parameter name to use for talk pages. cfg.talk = 'talk' -- The default value for talk pages. cfg.talkDefault = 'talk page' -- The parameter name to use for disambiguation pages page. cfg.dab = 'dab' -- This table holds the different possible aliases for disambiguation-class -- pages. These should be lower-case. cfg.dabAliases = { ['disambiguation'] = true, ['disambig'] = true, ['disamb'] = true, ['dab'] = true, } -- The default value for disambiguation pages. cfg.dabDefault = 'page' -- The parameter name to use for N/A-class page. cfg.na = 'na' -- This table holds the different possible aliases for N/A-class pages. These -- should be lower-case. cfg.naAliases = { ['na'] = true, ['n/a'] = true, } -- The default value for N/A-class pages. cfg.naDefault = 'page' -- The parameter name to use for redirects. cfg.redirect = 'redirect' -- The default value to use for redirects. cfg.redirectDefault = 'redirect' -- The parameter name for undefined namespaces. cfg.other = 'other' -- The value used if the module detects an undefined namespace. cfg.otherDefault = 'page' -- The usual suffix denoting a plural. cfg.plural = 's' -- This table holds plurals not formed by a simple suffix. cfg.irregularPlurals = { ["category"] = "categories" } -------------------------------------------------------------------------------- -- End configuration data -- -------------------------------------------------------------------------------- return cfg -- Don't edit this line 5360b93ef5fd7551e38026f1b8df00bed8b34b2d Template:Pagetype 10 61 86 2023-12-17T17:26:17Z BaiatArbore 2 Created page with "{{<includeonly>safesubst:</includeonly>#invoke:pagetype|main}}<noinclude> {{documentation}} <!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude>" wikitext text/x-wiki {{<includeonly>safesubst:</includeonly>#invoke:pagetype|main}}<noinclude> {{documentation}} <!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude> b8e6aa66678cd57877ea2c607372a45070f030a7 Module:Disambiguation/templates 828 62 87 2023-12-17T17:26:48Z BaiatArbore 2 Created page with "-- This page contains a table of all disambiguation templates and their -- redirects. Templates names are capitalized, and the Template: prefix is -- removed. Templates are grouped with the main template first, followed by -- its redirects. return { ["Disambiguation"] = true, ["Begriffsklärung"] = true, ["DAB"] = true, ["Dab"] = true, ["Dabpage"] = true, ["Dbig"] = true, ["Dis"] = true, ["Disam"] = true, ["Disamb"] = true, ["Disambig"] = true, ["Disambig mis..." Scribunto text/plain -- This page contains a table of all disambiguation templates and their -- redirects. Templates names are capitalized, and the Template: prefix is -- removed. Templates are grouped with the main template first, followed by -- its redirects. return { ["Disambiguation"] = true, ["Begriffsklärung"] = true, ["DAB"] = true, ["Dab"] = true, ["Dabpage"] = true, ["Dbig"] = true, ["Dis"] = true, ["Disam"] = true, ["Disamb"] = true, ["Disambig"] = true, ["Disambig misspelling"] = true, ["Disambig-plants"] = true, ["Disambiguation page"] = true, ["Meta disambig"] = true, ["Project disambiguation"] = true, ["Shortcut disambig"] = true, ["WP disambig"] = true, ["WP-disambig"] = true, ["Wikipedia disambiguation"] = true, ["Airport disambiguation"] = true, ["Airport disambig"] = true, ["Biology disambiguation"] = true, ["Call sign disambiguation"] = true, ["Callsigndis"] = true, ["Caselaw disambiguation"] = true, ["Case law disambiguation"] = true, ["Chinese title disambiguation"] = true, ["CJKVdab"] = true, ["Chinese title disambig"] = true, ["Disambig-Chinese-char-title"] = true, ["Disambiguation cleanup"] = true, ["Cleanup disambig"] = true, ["Cleanup disambiguation"] = true, ["CleanupDisambig"] = true, ["Dab cleanup"] = true, ["Dab-cleanup"] = true, ["Dabclean"] = true, ["Disamb-cleanup"] = true, ["Disambcleanup"] = true, ["Disambig cleanup"] = true, ["Disambig-CU"] = true, ["Disambig-cleanup"] = true, ["Disambig-cu"] = true, ["Disambigcleanup"] = true, ["Disambiguate-cleanup"] = true, ["Disambiguation-cleanup"] = true, ["Geodis-cleanup"] = true, ["Genus disambiguation"] = true, ["Genus disambig"] = true, ["Hangul title disambiguation"] = true, ["Hospital disambiguation"] = true, ["Hospitaldis"] = true, ["Human name disambiguation"] = true, ["Bio-dab"] = true, ["HNDIS"] = true, ["HnDis"] = true, ["Hndab"] = true, ["Hndis"] = true, ["Hndisambig"] = true, ["Human name dab"] = true, ["Personal name"] = true, ["Personal name disambiguation"] = true, ["Human name disambiguation cleanup"] = true, ["Hndis-cleanup"] = true, ["Personal name disambiguation cleanup"] = true, ["Hurricane season disambiguation"] = true, ["Letter–number combination disambiguation"] = true, ["LNCD"] = true, ["Letter-Number Combination Disambiguation"] = true, ["Letter-Number combination disambiguation"] = true, ["Letter-NumberCombDisambig"] = true, ["Letter-NumberCombdisambig"] = true, ["Letter-NumberCombinationDisambiguation"] = true, ["Letter-number combination disambiguation"] = true, ["Mathematical disambiguation"] = true, ["Math dab"] = true, ["Math disambiguation"] = true, ["Mathdab"] = true, ["Mathematics disambiguation"] = true, ["Maths disambiguation"] = true, ["Military unit disambiguation"] = true, ["Mil-unit-dis"] = true, ["Mil-unit-disambig"] = true, ["Music disambiguation"] = true, ["Music disambig"] = true, ["Number disambiguation"] = true, ["Numberdis"] = true, ["Numdab"] = true, ["Numdisambig"] = true, ["Opus number disambiguation"] = true, ["Phonetics disambiguation"] = true, ["Place name disambiguation"] = true, ["DisambigG"] = true, ["DisambigGeo"] = true, ["Disambiggeo"] = true, ["Geo-dis"] = true, ["Geodab"] = true, ["Geodis"] = true, ["Geodisambig"] = true, ["Geographic disambiguation"] = true, ["Portal disambiguation"] = true, ["Portal disambig"] = true, ["Road disambiguation"] = true, ["Roaddis"] = true, ["School disambiguation"] = true, ["School disambig"] = true, ["Schooldab"] = true, ["Schooldis"] = true, ["Species Latin name abbreviation disambiguation"] = true, ["Species Latin name disambiguation"] = true, ["LatinNameDisambig"] = true, ["SpeciesLatinNameDisambig"] = true, ["Station disambiguation"] = true, ["Station dab"] = true, ["Synagogue disambiguation"] = true, ["Taxonomic authority disambiguation"] = true, ["Taxonomic authorities disambiguation"] = true, ["Taxonomy disambiguation"] = true, ["Species disambiguation"] = true, ["Template disambiguation"] = true, ["Template ambiguous"] = true, ["Template dab"] = true, ["Template disambig"] = true, ["WoO number disambiguation"] = true, } 2cbee297a6101d351aacad836d4c2061407218dd File:LondonSkyline.png 6 63 88 2023-12-17T17:28:39Z BaiatArbore 2 wikitext text/x-wiki da39a3ee5e6b4b0d3255bfef95601890afd80709 Module:Location map/data/UK 828 64 92 2023-12-17T17:39:03Z BaiatArbore 2 Created page with "return require('Module:Location map/data/United Kingdom')" Scribunto text/plain return require('Module:Location map/data/United Kingdom') 956d295c8f61de493d536a7b9b33aa808ff0c29d Module:Location map/data/United Kingdom 828 65 93 2023-12-17T17:39:26Z BaiatArbore 2 Created page with "return { name = 'the United Kingdom', top = 61, bottom = 49, left = -11, right = 2.2, image = 'United Kingdom adm location map.svg', image1 = 'United Kingdom relief location map.jpg' }" Scribunto text/plain return { name = 'the United Kingdom', top = 61, bottom = 49, left = -11, right = 2.2, image = 'United Kingdom adm location map.svg', image1 = 'United Kingdom relief location map.jpg' } 1f97510fc974e293b60c91f5c448703dd31521fc Module:Location map/data/England 828 66 94 2023-12-17T17:41:57Z BaiatArbore 2 Created page with "return require('Module:Location map/data/UK England')" Scribunto text/plain return require('Module:Location map/data/UK England') c525afcde4cf326b070fd450b47a6a3c2c300467 Module:Location map/data/UK England 828 67 95 2023-12-17T17:42:15Z BaiatArbore 2 Created page with "return { name = 'England', top = 56, bottom = 49.75, left = -6.75, right = 2, image = 'England location map.svg', image1 = 'England relief location map.jpg' }" Scribunto text/plain return { name = 'England', top = 56, bottom = 49.75, left = -6.75, right = 2, image = 'England location map.svg', image1 = 'England relief location map.jpg' } fa3c64e7b65b8c67f9cc8b86fb2cfc88f628a1a5 Module:Location map/data/Europe 828 68 96 2023-12-17T17:43:14Z BaiatArbore 2 Created page with "return { name = 'Europe', y = '55.11 - 153.610*( cos( 52* pi/180)*sin( $1*pi/180 ) - sin( 52*pi/180 )*cos( $1*pi/180 )*cos( ($2-10)*pi/180 ) ) * ( ((1 + sin( $1*pi/180 )*sin( 52*pi/180 ) + cos( $1*pi/180 )*cos( 52*pi/180 )*cos( ($2-10)*pi/180 ) ) *0.5)^ -0.5)', x = '131.579*( cos( $1*pi/180 )*sin( ($2-10)*pi/180 ) ) * ( ((1 + sin( $1*pi/180 )*sin( 52*pi/180 ) + cos( $1*pi/180 )*cos( 52*pi/180 )*cos( ($2-10)*pi/180 ) ) *0.5)^ -0.5) - (-36.388)', image = 'Europe blank..." Scribunto text/plain return { name = 'Europe', y = '55.11 - 153.610*( cos( 52* pi/180)*sin( $1*pi/180 ) - sin( 52*pi/180 )*cos( $1*pi/180 )*cos( ($2-10)*pi/180 ) ) * ( ((1 + sin( $1*pi/180 )*sin( 52*pi/180 ) + cos( $1*pi/180 )*cos( 52*pi/180 )*cos( ($2-10)*pi/180 ) ) *0.5)^ -0.5)', x = '131.579*( cos( $1*pi/180 )*sin( ($2-10)*pi/180 ) ) * ( ((1 + sin( $1*pi/180 )*sin( 52*pi/180 ) + cos( $1*pi/180 )*cos( 52*pi/180 )*cos( ($2-10)*pi/180 ) ) *0.5)^ -0.5) - (-36.388)', image = 'Europe blank laea location map.svg', image1 = 'Europe relief laea location map.jpg' } 4f88142983070e8e03fac4ee684e533b5e44355e Poland 0 42 101 100 2023-12-18T19:16:14Z BaiatArbore 2 wikitext text/x-wiki '''Poland''' is a large country in [[Central Europe]], divided into 16 administrative provinces called [[voivodeships]]. It's located on the [[Great European Plain]], and is divided into 5 geographical sections - the seashore, the lake district, the lowlands, the highlands, and the mountains. It's one of the most populous countries in the [[European Union]] and is currently led by president [[Andrzej Duda]] and prime minister [[Donald Tusk]]. == Geography == Poland has a flat geography, lying on the Great European Plain, bordering the [[Baltic Sea]] at the north and the [[Sudets]] and [[Carpathian Mountains]] to the south. The country's longest river is the [[Vistula]], with next longest being [[Oder]] and [[Warta]]. It's bordered by [[Germany]] to the west, [[Czechia]] and [[Slovakia]] to the south, [[Ukraine]] and [[Belarus]] to the east, and [[Lithuania]] and [[Russia]] to the north. 832ec1cba1753448dd9487d88893d13b5e81ba4a Oder 0 69 102 2023-12-18T19:30:25Z BaiatArbore 2 Created page with "river == List of tributaries == {| class="wikitable" !Tributary name !Length |- |[[Wriezener Alte Oder]] |5.48 km<ref>https://pl.geoview.info/wriezener_alte_oder,35898874w</ref> |- |[[Warta]] |808.2 km |- |[[Friedrich-Wilhelm-Kanal]] |27 km |- |[[Lusatian Neisse]] |252 km |- |[[Bóbr]] |279 km |- |[[Barycz]] |136 km |- |[[Nysa Kłodzka]] |181.7 km |}" wikitext text/x-wiki river == List of tributaries == {| class="wikitable" !Tributary name !Length |- |[[Wriezener Alte Oder]] |5.48 km<ref>https://pl.geoview.info/wriezener_alte_oder,35898874w</ref> |- |[[Warta]] |808.2 km |- |[[Friedrich-Wilhelm-Kanal]] |27 km |- |[[Lusatian Neisse]] |252 km |- |[[Bóbr]] |279 km |- |[[Barycz]] |136 km |- |[[Nysa Kłodzka]] |181.7 km |} b8777d5751f5507df799a27642d39d570787ebfb Vistula 0 70 103 2023-12-20T18:44:57Z 78.8.210.152 0 Created page with "The Vistula river is the longest river in Poland." wikitext text/x-wiki The Vistula river is the longest river in Poland. b29f8bdfbc220116b6872c327dbc3126c0749d3f